| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/parsing/parse-info.h" | 5 #include "src/parsing/parse-info.h" |
| 6 | 6 |
| 7 #include "src/ast/ast-value-factory.h" | 7 #include "src/ast/ast-value-factory.h" |
| 8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 set_compiler_hints(shared->compiler_hints()); | 46 set_compiler_hints(shared->compiler_hints()); |
| 47 set_start_position(shared->start_position()); | 47 set_start_position(shared->start_position()); |
| 48 set_end_position(shared->end_position()); | 48 set_end_position(shared->end_position()); |
| 49 set_stack_limit(isolate_->stack_guard()->real_climit()); | 49 set_stack_limit(isolate_->stack_guard()->real_climit()); |
| 50 set_unicode_cache(isolate_->unicode_cache()); | 50 set_unicode_cache(isolate_->unicode_cache()); |
| 51 set_language_mode(shared->language_mode()); | 51 set_language_mode(shared->language_mode()); |
| 52 set_shared_info(shared); | 52 set_shared_info(shared); |
| 53 | 53 |
| 54 Handle<Script> script(Script::cast(shared->script())); | 54 Handle<Script> script(Script::cast(shared->script())); |
| 55 set_script(script); | 55 set_script(script); |
| 56 if (!script.is_null() && script->type() == Script::TYPE_NATIVE) { | 56 set_native(script->type() == Script::TYPE_NATIVE); |
| 57 set_native(); | 57 set_eval(script->compilation_type() == Script::COMPILATION_TYPE_EVAL); |
| 58 } | |
| 59 | 58 |
| 60 Handle<HeapObject> scope_info(shared->outer_scope_info()); | 59 Handle<HeapObject> scope_info(shared->outer_scope_info()); |
| 61 if (!scope_info->IsTheHole(isolate()) && | 60 if (!scope_info->IsTheHole(isolate()) && |
| 62 Handle<ScopeInfo>::cast(scope_info)->length() > 0) { | 61 Handle<ScopeInfo>::cast(scope_info)->length() > 0) { |
| 63 set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info)); | 62 set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info)); |
| 64 } | 63 } |
| 65 } | 64 } |
| 66 | 65 |
| 67 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { | 66 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { |
| 68 isolate_ = script->GetIsolate(); | 67 isolate_ = script->GetIsolate(); |
| 69 | 68 |
| 70 set_toplevel(); | 69 set_toplevel(); |
| 71 set_hash_seed(isolate_->heap()->HashSeed()); | 70 set_hash_seed(isolate_->heap()->HashSeed()); |
| 72 set_stack_limit(isolate_->stack_guard()->real_climit()); | 71 set_stack_limit(isolate_->stack_guard()->real_climit()); |
| 73 set_unicode_cache(isolate_->unicode_cache()); | 72 set_unicode_cache(isolate_->unicode_cache()); |
| 74 set_script(script); | 73 set_script(script); |
| 75 | 74 |
| 76 if (script->type() == Script::TYPE_NATIVE) { | 75 set_native(script->type() == Script::TYPE_NATIVE); |
| 77 set_native(); | 76 set_eval(script->compilation_type() == Script::COMPILATION_TYPE_EVAL); |
| 78 } | |
| 79 } | 77 } |
| 80 | 78 |
| 81 ParseInfo::~ParseInfo() { | 79 ParseInfo::~ParseInfo() { |
| 82 if (ast_value_factory_owned()) { | 80 if (ast_value_factory_owned()) { |
| 83 delete ast_value_factory_; | 81 delete ast_value_factory_; |
| 84 set_ast_value_factory_owned(false); | 82 set_ast_value_factory_owned(false); |
| 85 } | 83 } |
| 86 ast_value_factory_ = nullptr; | 84 ast_value_factory_ = nullptr; |
| 87 } | 85 } |
| 88 | 86 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 106 } | 104 } |
| 107 | 105 |
| 108 #ifdef DEBUG | 106 #ifdef DEBUG |
| 109 bool ParseInfo::script_is_native() const { | 107 bool ParseInfo::script_is_native() const { |
| 110 return script_->type() == Script::TYPE_NATIVE; | 108 return script_->type() == Script::TYPE_NATIVE; |
| 111 } | 109 } |
| 112 #endif // DEBUG | 110 #endif // DEBUG |
| 113 | 111 |
| 114 } // namespace internal | 112 } // namespace internal |
| 115 } // namespace v8 | 113 } // namespace v8 |
| OLD | NEW |