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