OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 i::OS::SNPrintF(program, "%s%s%s", | 1009 i::OS::SNPrintF(program, "%s%s%s", |
1010 source_data[i].outer_prefix, | 1010 source_data[i].outer_prefix, |
1011 source_data[i].inner_source, | 1011 source_data[i].inner_source, |
1012 source_data[i].outer_suffix); | 1012 source_data[i].outer_suffix); |
1013 | 1013 |
1014 // Parse program source. | 1014 // Parse program source. |
1015 i::Handle<i::String> source( | 1015 i::Handle<i::String> source( |
1016 FACTORY->NewStringFromUtf8(i::CStrVector(program.start()))); | 1016 FACTORY->NewStringFromUtf8(i::CStrVector(program.start()))); |
1017 CHECK_EQ(source->length(), kProgramSize); | 1017 CHECK_EQ(source->length(), kProgramSize); |
1018 i::Handle<i::Script> script = FACTORY->NewScript(source); | 1018 i::Handle<i::Script> script = FACTORY->NewScript(source); |
1019 i::Parser parser(script, i::kAllowLazy | i::EXTENDED_MODE, NULL, NULL, | |
1020 i::Isolate::Current()->runtime_zone()); | |
1021 i::CompilationInfoWithZone info(script); | 1019 i::CompilationInfoWithZone info(script); |
| 1020 i::Parser parser(&info, i::kAllowLazy | i::EXTENDED_MODE, NULL, NULL); |
1022 info.MarkAsGlobal(); | 1021 info.MarkAsGlobal(); |
1023 info.SetLanguageMode(source_data[i].language_mode); | 1022 info.SetLanguageMode(source_data[i].language_mode); |
1024 i::FunctionLiteral* function = parser.ParseProgram(&info); | 1023 i::FunctionLiteral* function = parser.ParseProgram(); |
1025 CHECK(function != NULL); | 1024 CHECK(function != NULL); |
1026 | 1025 |
1027 // Check scope types and positions. | 1026 // Check scope types and positions. |
1028 i::Scope* scope = function->scope(); | 1027 i::Scope* scope = function->scope(); |
1029 CHECK(scope->is_global_scope()); | 1028 CHECK(scope->is_global_scope()); |
1030 CHECK_EQ(scope->start_position(), 0); | 1029 CHECK_EQ(scope->start_position(), 0); |
1031 CHECK_EQ(scope->end_position(), kProgramSize); | 1030 CHECK_EQ(scope->end_position(), kProgramSize); |
1032 CHECK_EQ(scope->inner_scopes()->length(), 1); | 1031 CHECK_EQ(scope->inner_scopes()->length(), 1); |
1033 | 1032 |
1034 i::Scope* inner_scope = scope->inner_scopes()->at(0); | 1033 i::Scope* inner_scope = scope->inner_scopes()->at(0); |
(...skipping 19 matching lines...) Expand all Loading... |
1054 v8::preparser::PreParser::PreParseResult result = | 1053 v8::preparser::PreParser::PreParseResult result = |
1055 v8::preparser::PreParser::PreParseProgram( | 1054 v8::preparser::PreParser::PreParseProgram( |
1056 &scanner, &log, flags, stack_limit); | 1055 &scanner, &log, flags, stack_limit); |
1057 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); | 1056 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); |
1058 i::ScriptDataImpl data(log.ExtractData()); | 1057 i::ScriptDataImpl data(log.ExtractData()); |
1059 | 1058 |
1060 // Parse the data | 1059 // Parse the data |
1061 i::Handle<i::Script> script = FACTORY->NewScript(source); | 1060 i::Handle<i::Script> script = FACTORY->NewScript(source); |
1062 bool save_harmony_scoping = i::FLAG_harmony_scoping; | 1061 bool save_harmony_scoping = i::FLAG_harmony_scoping; |
1063 i::FLAG_harmony_scoping = harmony_scoping; | 1062 i::FLAG_harmony_scoping = harmony_scoping; |
1064 i::Parser parser(script, flags, NULL, NULL, | |
1065 i::Isolate::Current()->runtime_zone()); | |
1066 i::CompilationInfoWithZone info(script); | 1063 i::CompilationInfoWithZone info(script); |
| 1064 i::Parser parser(&info, flags, NULL, NULL); |
1067 info.MarkAsGlobal(); | 1065 info.MarkAsGlobal(); |
1068 i::FunctionLiteral* function = parser.ParseProgram(&info); | 1066 i::FunctionLiteral* function = parser.ParseProgram(); |
1069 i::FLAG_harmony_scoping = save_harmony_scoping; | 1067 i::FLAG_harmony_scoping = save_harmony_scoping; |
1070 | 1068 |
1071 i::String* type_string = NULL; | 1069 i::String* type_string = NULL; |
1072 if (function == NULL) { | 1070 if (function == NULL) { |
1073 // Extract exception from the parser. | 1071 // Extract exception from the parser. |
1074 i::Handle<i::String> type_symbol = FACTORY->LookupAsciiSymbol("type"); | 1072 i::Handle<i::String> type_symbol = FACTORY->LookupAsciiSymbol("type"); |
1075 CHECK(i::Isolate::Current()->has_pending_exception()); | 1073 CHECK(i::Isolate::Current()->has_pending_exception()); |
1076 i::MaybeObject* maybe_object = i::Isolate::Current()->pending_exception(); | 1074 i::MaybeObject* maybe_object = i::Isolate::Current()->pending_exception(); |
1077 i::JSObject* exception = NULL; | 1075 i::JSObject* exception = NULL; |
1078 CHECK(maybe_object->To(&exception)); | 1076 CHECK(maybe_object->To(&exception)); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 termination_data[k], | 1229 termination_data[k], |
1232 context_data[i][1]); | 1230 context_data[i][1]); |
1233 CHECK(length == kProgramSize); | 1231 CHECK(length == kProgramSize); |
1234 i::Handle<i::String> source = | 1232 i::Handle<i::String> source = |
1235 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); | 1233 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); |
1236 TestParserSyncWithFlags(source); | 1234 TestParserSyncWithFlags(source); |
1237 } | 1235 } |
1238 } | 1236 } |
1239 } | 1237 } |
1240 } | 1238 } |
OLD | NEW |