OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler.h" | 5 #include "src/compiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 } | 1464 } |
1465 | 1465 |
1466 if (!maybe_result.ToHandle(&result)) { | 1466 if (!maybe_result.ToHandle(&result)) { |
1467 // No cache entry found. Compile the script. | 1467 // No cache entry found. Compile the script. |
1468 | 1468 |
1469 // Create a script object describing the script to be compiled. | 1469 // Create a script object describing the script to be compiled. |
1470 Handle<Script> script = isolate->factory()->NewScript(source); | 1470 Handle<Script> script = isolate->factory()->NewScript(source); |
1471 if (natives == NATIVES_CODE) { | 1471 if (natives == NATIVES_CODE) { |
1472 script->set_type(Script::TYPE_NATIVE); | 1472 script->set_type(Script::TYPE_NATIVE); |
1473 script->set_hide_source(true); | 1473 script->set_hide_source(true); |
| 1474 } else if (natives == EXTENSION_CODE) { |
| 1475 script->set_type(Script::TYPE_EXTENSION); |
| 1476 script->set_hide_source(true); |
1474 } | 1477 } |
1475 if (!script_name.is_null()) { | 1478 if (!script_name.is_null()) { |
1476 script->set_name(*script_name); | 1479 script->set_name(*script_name); |
1477 script->set_line_offset(line_offset); | 1480 script->set_line_offset(line_offset); |
1478 script->set_column_offset(column_offset); | 1481 script->set_column_offset(column_offset); |
1479 } | 1482 } |
1480 script->set_origin_options(resource_options); | 1483 script->set_origin_options(resource_options); |
1481 if (!source_map_url.is_null()) { | 1484 if (!source_map_url.is_null()) { |
1482 script->set_source_mapping_url(*source_map_url); | 1485 script->set_source_mapping_url(*source_map_url); |
1483 } | 1486 } |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1862 } | 1865 } |
1863 | 1866 |
1864 #if DEBUG | 1867 #if DEBUG |
1865 void CompilationInfo::PrintAstForTesting() { | 1868 void CompilationInfo::PrintAstForTesting() { |
1866 PrintF("--- Source from AST ---\n%s\n", | 1869 PrintF("--- Source from AST ---\n%s\n", |
1867 PrettyPrinter(isolate()).PrintProgram(literal())); | 1870 PrettyPrinter(isolate()).PrintProgram(literal())); |
1868 } | 1871 } |
1869 #endif | 1872 #endif |
1870 } // namespace internal | 1873 } // namespace internal |
1871 } // namespace v8 | 1874 } // namespace v8 |
OLD | NEW |