| 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 14 matching lines...) Expand all Loading... |
| 25 compiler_hints_(0), | 25 compiler_hints_(0), |
| 26 start_position_(0), | 26 start_position_(0), |
| 27 end_position_(0), | 27 end_position_(0), |
| 28 isolate_(nullptr), | 28 isolate_(nullptr), |
| 29 cached_data_(nullptr), | 29 cached_data_(nullptr), |
| 30 ast_value_factory_(nullptr), | 30 ast_value_factory_(nullptr), |
| 31 function_name_(nullptr), | 31 function_name_(nullptr), |
| 32 literal_(nullptr) {} | 32 literal_(nullptr) {} |
| 33 | 33 |
| 34 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function) | 34 ParseInfo::ParseInfo(Zone* zone, Handle<JSFunction> function) |
| 35 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) { | 35 : ParseInfo(zone, Handle<SharedFunctionInfo>(function->shared())) {} |
| 36 if (!function->context()->IsNativeContext()) { | |
| 37 set_outer_scope_info(handle(function->context()->scope_info())); | |
| 38 } | |
| 39 } | |
| 40 | 36 |
| 41 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) | 37 ParseInfo::ParseInfo(Zone* zone, Handle<SharedFunctionInfo> shared) |
| 42 : ParseInfo(zone) { | 38 : ParseInfo(zone) { |
| 43 isolate_ = shared->GetIsolate(); | 39 isolate_ = shared->GetIsolate(); |
| 44 | 40 |
| 45 set_lazy(); | 41 set_lazy(); |
| 46 set_hash_seed(isolate_->heap()->HashSeed()); | 42 set_hash_seed(isolate_->heap()->HashSeed()); |
| 47 set_is_named_expression(shared->is_named_expression()); | 43 set_is_named_expression(shared->is_named_expression()); |
| 48 set_calls_eval(shared->scope_info()->CallsEval()); | 44 set_calls_eval(shared->scope_info()->CallsEval()); |
| 49 set_compiler_hints(shared->compiler_hints()); | 45 set_compiler_hints(shared->compiler_hints()); |
| 50 set_start_position(shared->start_position()); | 46 set_start_position(shared->start_position()); |
| 51 set_end_position(shared->end_position()); | 47 set_end_position(shared->end_position()); |
| 52 set_stack_limit(isolate_->stack_guard()->real_climit()); | 48 set_stack_limit(isolate_->stack_guard()->real_climit()); |
| 53 set_unicode_cache(isolate_->unicode_cache()); | 49 set_unicode_cache(isolate_->unicode_cache()); |
| 54 set_language_mode(shared->language_mode()); | 50 set_language_mode(shared->language_mode()); |
| 55 set_shared_info(shared); | 51 set_shared_info(shared); |
| 56 | 52 |
| 57 Handle<Script> script(Script::cast(shared->script())); | 53 Handle<Script> script(Script::cast(shared->script())); |
| 58 set_script(script); | 54 set_script(script); |
| 59 if (!script.is_null() && script->type() == Script::TYPE_NATIVE) { | 55 if (!script.is_null() && script->type() == Script::TYPE_NATIVE) { |
| 60 set_native(); | 56 set_native(); |
| 61 } | 57 } |
| 58 |
| 59 Handle<HeapObject> scope_info(shared->outer_scope_info()); |
| 60 if (!scope_info->IsTheHole(isolate()) && |
| 61 Handle<ScopeInfo>::cast(scope_info)->length() > 0) { |
| 62 set_outer_scope_info(Handle<ScopeInfo>::cast(scope_info)); |
| 63 } |
| 62 } | 64 } |
| 63 | 65 |
| 64 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { | 66 ParseInfo::ParseInfo(Zone* zone, Handle<Script> script) : ParseInfo(zone) { |
| 65 isolate_ = script->GetIsolate(); | 67 isolate_ = script->GetIsolate(); |
| 66 | 68 |
| 67 set_hash_seed(isolate_->heap()->HashSeed()); | 69 set_hash_seed(isolate_->heap()->HashSeed()); |
| 68 set_stack_limit(isolate_->stack_guard()->real_climit()); | 70 set_stack_limit(isolate_->stack_guard()->real_climit()); |
| 69 set_unicode_cache(isolate_->unicode_cache()); | 71 set_unicode_cache(isolate_->unicode_cache()); |
| 70 set_script(script); | 72 set_script(script); |
| 71 | 73 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 102 } | 104 } |
| 103 | 105 |
| 104 #ifdef DEBUG | 106 #ifdef DEBUG |
| 105 bool ParseInfo::script_is_native() const { | 107 bool ParseInfo::script_is_native() const { |
| 106 return script_->type() == Script::TYPE_NATIVE; | 108 return script_->type() == Script::TYPE_NATIVE; |
| 107 } | 109 } |
| 108 #endif // DEBUG | 110 #endif // DEBUG |
| 109 | 111 |
| 110 } // namespace internal | 112 } // namespace internal |
| 111 } // namespace v8 | 113 } // namespace v8 |
| OLD | NEW |