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); | 1019 i::Parser parser(script, i::kAllowLazy | i::EXTENDED_MODE, NULL, NULL, |
| 1020 i::Isolate::Current()->zone()); |
1020 i::CompilationInfo info(script); | 1021 i::CompilationInfo info(script); |
1021 info.MarkAsGlobal(); | 1022 info.MarkAsGlobal(); |
1022 info.SetLanguageMode(source_data[i].language_mode); | 1023 info.SetLanguageMode(source_data[i].language_mode); |
1023 i::FunctionLiteral* function = parser.ParseProgram(&info); | 1024 i::FunctionLiteral* function = parser.ParseProgram(&info); |
1024 CHECK(function != NULL); | 1025 CHECK(function != NULL); |
1025 | 1026 |
1026 // Check scope types and positions. | 1027 // Check scope types and positions. |
1027 i::Scope* scope = function->scope(); | 1028 i::Scope* scope = function->scope(); |
1028 CHECK(scope->is_global_scope()); | 1029 CHECK(scope->is_global_scope()); |
1029 CHECK_EQ(scope->start_position(), 0); | 1030 CHECK_EQ(scope->start_position(), 0); |
(...skipping 23 matching lines...) Expand all Loading... |
1053 v8::preparser::PreParser::PreParseResult result = | 1054 v8::preparser::PreParser::PreParseResult result = |
1054 v8::preparser::PreParser::PreParseProgram( | 1055 v8::preparser::PreParser::PreParseProgram( |
1055 &scanner, &log, flags, stack_limit); | 1056 &scanner, &log, flags, stack_limit); |
1056 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); | 1057 CHECK_EQ(v8::preparser::PreParser::kPreParseSuccess, result); |
1057 i::ScriptDataImpl data(log.ExtractData()); | 1058 i::ScriptDataImpl data(log.ExtractData()); |
1058 | 1059 |
1059 // Parse the data | 1060 // Parse the data |
1060 i::Handle<i::Script> script = FACTORY->NewScript(source); | 1061 i::Handle<i::Script> script = FACTORY->NewScript(source); |
1061 bool save_harmony_scoping = i::FLAG_harmony_scoping; | 1062 bool save_harmony_scoping = i::FLAG_harmony_scoping; |
1062 i::FLAG_harmony_scoping = harmony_scoping; | 1063 i::FLAG_harmony_scoping = harmony_scoping; |
1063 i::Parser parser(script, flags, NULL, NULL); | 1064 i::Parser parser(script, flags, NULL, NULL, i::Isolate::Current()->zone()); |
1064 i::CompilationInfo info(script); | 1065 i::CompilationInfo info(script); |
1065 info.MarkAsGlobal(); | 1066 info.MarkAsGlobal(); |
1066 i::FunctionLiteral* function = parser.ParseProgram(&info); | 1067 i::FunctionLiteral* function = parser.ParseProgram(&info); |
1067 i::FLAG_harmony_scoping = save_harmony_scoping; | 1068 i::FLAG_harmony_scoping = save_harmony_scoping; |
1068 | 1069 |
1069 i::String* type_string = NULL; | 1070 i::String* type_string = NULL; |
1070 if (function == NULL) { | 1071 if (function == NULL) { |
1071 // Extract exception from the parser. | 1072 // Extract exception from the parser. |
1072 i::Handle<i::String> type_symbol = FACTORY->LookupAsciiSymbol("type"); | 1073 i::Handle<i::String> type_symbol = FACTORY->LookupAsciiSymbol("type"); |
1073 CHECK(i::Isolate::Current()->has_pending_exception()); | 1074 CHECK(i::Isolate::Current()->has_pending_exception()); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1229 termination_data[k], | 1230 termination_data[k], |
1230 context_data[i][1]); | 1231 context_data[i][1]); |
1231 CHECK(length == kProgramSize); | 1232 CHECK(length == kProgramSize); |
1232 i::Handle<i::String> source = | 1233 i::Handle<i::String> source = |
1233 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); | 1234 FACTORY->NewStringFromAscii(i::CStrVector(program.start())); |
1234 TestParserSyncWithFlags(source); | 1235 TestParserSyncWithFlags(source); |
1235 } | 1236 } |
1236 } | 1237 } |
1237 } | 1238 } |
1238 } | 1239 } |
OLD | NEW |