v8
3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "v8.h"
#include "cctest.h"
#include "compiler.h"
#include "execution.h"
#include "isolate.h"
#include "parser.h"
#include "preparser.h"
#include "scanner-character-streams.h"
#include "token.h"
#include "utils.h"
Go to the source code of this file.
Data Structures | |
class | ScriptResource |
class | TestExternalResource |
Macros | |
#define | KEYWORD(t, s, d) { s, i::Token::t }, |
#define | CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2)) |
Functions | |
TEST (ScanKeywords) | |
TEST (ScanHTMLEndComments) | |
TEST (Preparsing) | |
TEST (StandAlonePreParser) | |
TEST (StandAlonePreParserNoNatives) | |
TEST (RegressChromium62639) | |
TEST (Regress928) | |
TEST (PreParseOverflow) | |
void | TestCharacterStream (const char *ascii_source, unsigned length, unsigned start=0, unsigned end=0) |
TEST (CharacterStreams) | |
TEST (Utf8CharacterStream) | |
void | TestStreamScanner (i::Utf16CharacterStream *stream, i::Token::Value *expected_tokens, int skip_pos=0, int skip_to=0) |
TEST (StreamScanner) | |
void | TestScanRegExp (const char *re_source, const char *expected) |
TEST (RegExpScanning) | |
TEST (ScopePositions) | |
void | TestParserSync (i::Handle< i::String > source, int flags) |
void | TestParserSyncWithFlags (i::Handle< i::String > source) |
TEST (ParserSync) | |
TEST (PreparserStrictOctal) | |
#define CHECK_EQU | ( | v1, | |
v2 | |||
) | CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2)) |
Definition at line 434 of file test-parsing.cc.
Referenced by TEST(), and TestCharacterStream().
#define KEYWORD | ( | t, | |
s, | |||
d | |||
) | { s, i::Token::t }, |
Referenced by TEST().
TEST | ( | ScanKeywords | ) |
Definition at line 44 of file test-parsing.cc.
References ARRAY_SIZE, CHECK, CHECK_EQ, IGNORE_TOKEN, Scanner::Initialize(), KEYWORD, Scanner::Next(), NULL, Scanner::SetHarmonyModules(), Scanner::SetHarmonyScoping(), v8::internal::StrLength(), and TOKEN_LIST.
TEST | ( | ScanHTMLEndComments | ) |
Definition at line 108 of file test-parsing.cc.
References CHECK, ScriptData::HasError(), V8::Initialize(), NULL, ScriptData::PreCompile(), and v8::internal::StrLength().
TEST | ( | Preparsing | ) |
Definition at line 175 of file test-parsing.cc.
References CHECK, CHECK_EQ, CHECK_GT, Script::Compile(), ScriptData::HasError(), message, ScriptDataImpl::MessageLocation(), Script::New(), Context::New(), String::NewExternal(), NULL, ScriptData::PreCompile(), and v8::internal::StrLength().
TEST | ( | StandAlonePreParser | ) |
Definition at line 239 of file test-parsing.cc.
References CHECK, CHECK_EQ, CompleteParserRecorder::ExtractData(), flags, Scanner::Initialize(), V8::Initialize(), v8::internal::kAllowLazy, v8::internal::kAllowNativesSyntax, PreParser::kPreParseSuccess, NULL, and PreParser::PreParseProgram().
TEST | ( | StandAlonePreParserNoNatives | ) |
Definition at line 278 of file test-parsing.cc.
References CHECK, CHECK_EQ, CompleteParserRecorder::ExtractData(), Scanner::Initialize(), V8::Initialize(), v8::internal::kAllowLazy, PreParser::kPreParseSuccess, NULL, and PreParser::PreParseProgram().
TEST | ( | RegressChromium62639 | ) |
Definition at line 315 of file test-parsing.cc.
References CHECK, ScriptDataImpl::HasError(), V8::Initialize(), NULL, and ParserApi::PreParse().
TEST | ( | Regress928 | ) |
Definition at line 339 of file test-parsing.cc.
References CHECK, CHECK_EQ, v8::internal::CStrVector(), FACTORY, V8::Initialize(), NULL, ParserApi::PreParse(), and v8::internal::StrLength().
TEST | ( | PreParseOverflow | ) |
Definition at line 382 of file test-parsing.cc.
References CHECK_EQ, Scanner::Initialize(), V8::Initialize(), PreParser::kPreParseStackOverflow, and PreParser::PreParseProgram().
TEST | ( | CharacterStreams | ) |
Definition at line 546 of file test-parsing.cc.
References Context::New(), and TestCharacterStream().
TEST | ( | Utf8CharacterStream | ) |
Definition at line 566 of file test-parsing.cc.
References Utf16CharacterStream::Advance(), ASSERT, CHECK_EQ, CHECK_EQU, Utf8::Encode(), Utf8::kMaxOneByteChar, Utf8::kMaxThreeByteChar, Utf8::kMaxTwoByteChar, Utf16::kNoPreviousCharacter, Utf16CharacterStream::pos(), BufferedUtf16CharacterStream::PushBack(), and Utf16CharacterStream::SeekForward().
TEST | ( | StreamScanner | ) |
Definition at line 636 of file test-parsing.cc.
References ASSERT_EQ, v8::internal::CONST, v8::DEFAULT, v8::internal::DIV, V8::Initialize(), v8::internal::MUL, v8::internal::SUB, and TestStreamScanner().
TEST | ( | RegExpScanning | ) |
Definition at line 718 of file test-parsing.cc.
References V8::Initialize(), and TestScanRegExp().
TEST | ( | ScopePositions | ) |
Definition at line 816 of file test-parsing.cc.
References v8::internal::BLOCK_SCOPE, v8::internal::CATCH_SCOPE, CHECK, CHECK_EQ, v8::internal::CLASSIC_MODE, v8::internal::CStrVector(), Scope::end_position(), v8::internal::EVAL_SCOPE, v8::internal::EXTENDED_MODE, FACTORY, v8::internal::FUNCTION_SCOPE, Scope::inner_scopes(), Scope::is_global_scope(), v8::internal::kAllowLazy, CompilationInfo::MarkAsGlobal(), Vector< T >::New(), Context::New(), NULL, Parser::ParseProgram(), CompilationInfo::SetLanguageMode(), OS::SNPrintF(), Vector< T >::start(), Scope::start_position(), v8::internal::StrLength(), and v8::internal::WITH_SCOPE.
TEST | ( | ParserSync | ) |
Definition at line 1138 of file test-parsing.cc.
References CHECK, v8::internal::CStrVector(), FACTORY, Vector< T >::New(), Context::New(), NULL, OS::SNPrintF(), Vector< T >::start(), v8::internal::StrLength(), and TestParserSyncWithFlags().
TEST | ( | PreparserStrictOctal | ) |
Definition at line 1243 of file test-parsing.cc.
References CHECK, CHECK_EQ, Script::Compile(), TryCatch::Exception(), TryCatch::HasCaught(), V8::Initialize(), String::New(), and Context::New().
void TestCharacterStream | ( | const char * | ascii_source, |
unsigned | length, | ||
unsigned | start = 0 , |
||
unsigned | end = 0 |
||
) |
Definition at line 436 of file test-parsing.cc.
References Utf16CharacterStream::Advance(), CHECK_EQ, CHECK_EQU, CHECK_LT, FACTORY, Utf16CharacterStream::pos(), BufferedUtf16CharacterStream::PushBack(), and Utf16CharacterStream::SeekForward().
Referenced by TEST().
Definition at line 1044 of file test-parsing.cc.
References CHECK, CHECK_EQ, v8::internal::CStrVector(), v8::internal::EXTENDED_MODE, CompleteParserRecorder::ExtractData(), FACTORY, flags, Object::GetProperty(), Scanner::Initialize(), String::IsEqualTo(), v8::internal::kLanguageModeMask, PreParser::kPreParseSuccess, CompilationInfo::MarkAsGlobal(), NULL, Parser::ParseProgram(), PreParser::PreParseProgram(), OS::Print(), Scanner::SetHarmonyScoping(), and String::ToCString().
Referenced by TestParserSyncWithFlags().
Definition at line 1121 of file test-parsing.cc.
References v8::internal::CLASSIC_MODE, v8::internal::EXTENDED_MODE, flags, v8::internal::kAllowLazy, v8::internal::kNoParsingFlags, v8::internal::STRICT_MODE, and TestParserSync().
Referenced by TEST().
void TestScanRegExp | ( | const char * | re_source, |
const char * | expected | ||
) |
Definition at line 698 of file test-parsing.cc.
References CHECK, CHECK_EQ, CHECK_NE, v8::internal::DIV, Scanner::Initialize(), Scanner::is_literal_ascii(), Scanner::literal_ascii_string(), Scanner::Next(), Scanner::peek(), and Scanner::ScanRegExpPattern().
Referenced by TEST().
void TestStreamScanner | ( | i::Utf16CharacterStream * | stream, |
i::Token::Value * | expected_tokens, | ||
int | skip_pos = 0 , |
||
int | skip_to = 0 |
||
) |
Definition at line 617 of file test-parsing.cc.
References CHECK_EQ, Scanner::Location::end_pos, Scanner::Initialize(), Scanner::location(), Scanner::Next(), Scanner::SeekForward(), and Token::String().
Referenced by TEST().