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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/ast.h" | 8 #include "src/ast.h" |
9 #include "src/base/platform/platform.h" | 9 #include "src/base/platform/platform.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 852 |
853 | 853 |
854 FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info, | 854 FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info, |
855 Handle<String> source) { | 855 Handle<String> source) { |
856 ASSERT(scope_ == NULL); | 856 ASSERT(scope_ == NULL); |
857 ASSERT(target_stack_ == NULL); | 857 ASSERT(target_stack_ == NULL); |
858 | 858 |
859 FunctionLiteral* result = NULL; | 859 FunctionLiteral* result = NULL; |
860 { Scope* scope = NewScope(scope_, GLOBAL_SCOPE); | 860 { Scope* scope = NewScope(scope_, GLOBAL_SCOPE); |
861 info->SetGlobalScope(scope); | 861 info->SetGlobalScope(scope); |
862 if (!info->context().is_null()) { | 862 if (!info->context().is_null() && !info->context()->IsNativeContext()) { |
863 scope = Scope::DeserializeScopeChain(*info->context(), scope, zone()); | 863 scope = Scope::DeserializeScopeChain(*info->context(), scope, zone()); |
864 // The Scope is backed up by ScopeInfo (which is in the V8 heap); this | 864 // The Scope is backed up by ScopeInfo (which is in the V8 heap); this |
865 // means the Parser cannot operate independent of the V8 heap. Tell the | 865 // means the Parser cannot operate independent of the V8 heap. Tell the |
866 // string table to internalize strings and values right after they're | 866 // string table to internalize strings and values right after they're |
867 // created. | 867 // created. |
868 ast_value_factory_->Internalize(isolate()); | 868 ast_value_factory_->Internalize(isolate()); |
869 } | 869 } |
870 original_scope_ = scope; | 870 original_scope_ = scope; |
871 if (info->is_eval()) { | 871 if (info->is_eval()) { |
872 if (!scope->is_global_scope() || info->strict_mode() == STRICT) { | 872 if (!scope->is_global_scope() || info->strict_mode() == STRICT) { |
(...skipping 4013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4886 info()->SetAstValueFactory(ast_value_factory_); | 4886 info()->SetAstValueFactory(ast_value_factory_); |
4887 } | 4887 } |
4888 ast_value_factory_ = NULL; | 4888 ast_value_factory_ = NULL; |
4889 | 4889 |
4890 InternalizeUseCounts(); | 4890 InternalizeUseCounts(); |
4891 | 4891 |
4892 return (result != NULL); | 4892 return (result != NULL); |
4893 } | 4893 } |
4894 | 4894 |
4895 } } // namespace v8::internal | 4895 } } // namespace v8::internal |
OLD | NEW |