OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/arguments.h" | 8 #include "src/arguments.h" |
9 #include "src/debug.h" | 9 #include "src/debug.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1140 // Reparse the code and analyze the scopes. | 1140 // Reparse the code and analyze the scopes. |
1141 Handle<Script> script(Script::cast(shared_info->script())); | 1141 Handle<Script> script(Script::cast(shared_info->script())); |
1142 Scope* scope = NULL; | 1142 Scope* scope = NULL; |
1143 | 1143 |
1144 // Check whether we are in global, eval or function code. | 1144 // Check whether we are in global, eval or function code. |
1145 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 1145 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
1146 if (scope_info->scope_type() != FUNCTION_SCOPE && | 1146 if (scope_info->scope_type() != FUNCTION_SCOPE && |
1147 scope_info->scope_type() != ARROW_SCOPE) { | 1147 scope_info->scope_type() != ARROW_SCOPE) { |
1148 // Global or eval code. | 1148 // Global or eval code. |
1149 CompilationInfoWithZone info(script); | 1149 CompilationInfoWithZone info(script); |
1150 if (scope_info->scope_type() == GLOBAL_SCOPE) { | 1150 if (scope_info->scope_type() == SCRIPT_SCOPE) { |
1151 info.MarkAsGlobal(); | 1151 info.MarkAsGlobal(); |
1152 } else { | 1152 } else { |
1153 DCHECK(scope_info->scope_type() == EVAL_SCOPE); | 1153 DCHECK(scope_info->scope_type() == EVAL_SCOPE); |
1154 info.MarkAsEval(); | 1154 info.MarkAsEval(); |
1155 info.SetContext(Handle<Context>(function_->context())); | 1155 info.SetContext(Handle<Context>(function_->context())); |
1156 } | 1156 } |
1157 if (Parser::Parse(&info) && Scope::Analyze(&info)) { | 1157 if (Parser::Parse(&info) && Scope::Analyze(&info)) { |
1158 scope = info.function()->scope(); | 1158 scope = info.function()->scope(); |
1159 } | 1159 } |
1160 RetrieveScopeChain(scope, shared_info); | 1160 RetrieveScopeChain(scope, shared_info); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1216 if (!nested_scope_chain_.is_empty()) { | 1216 if (!nested_scope_chain_.is_empty()) { |
1217 Handle<ScopeInfo> scope_info = nested_scope_chain_.last(); | 1217 Handle<ScopeInfo> scope_info = nested_scope_chain_.last(); |
1218 switch (scope_info->scope_type()) { | 1218 switch (scope_info->scope_type()) { |
1219 case FUNCTION_SCOPE: | 1219 case FUNCTION_SCOPE: |
1220 case ARROW_SCOPE: | 1220 case ARROW_SCOPE: |
1221 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext()); | 1221 DCHECK(context_->IsFunctionContext() || !scope_info->HasContext()); |
1222 return ScopeTypeLocal; | 1222 return ScopeTypeLocal; |
1223 case MODULE_SCOPE: | 1223 case MODULE_SCOPE: |
1224 DCHECK(context_->IsModuleContext()); | 1224 DCHECK(context_->IsModuleContext()); |
1225 return ScopeTypeModule; | 1225 return ScopeTypeModule; |
1226 case GLOBAL_SCOPE: | 1226 case SCRIPT_SCOPE: |
1227 DCHECK(context_->IsNativeContext()); | 1227 DCHECK(context_->IsNativeContext()); |
1228 return ScopeTypeGlobal; | 1228 return ScopeTypeGlobal; |
1229 case WITH_SCOPE: | 1229 case WITH_SCOPE: |
1230 DCHECK(context_->IsWithContext()); | 1230 DCHECK(context_->IsWithContext()); |
1231 return ScopeTypeWith; | 1231 return ScopeTypeWith; |
1232 case CATCH_SCOPE: | 1232 case CATCH_SCOPE: |
1233 DCHECK(context_->IsCatchContext()); | 1233 DCHECK(context_->IsCatchContext()); |
1234 return ScopeTypeCatch; | 1234 return ScopeTypeCatch; |
1235 case BLOCK_SCOPE: | 1235 case BLOCK_SCOPE: |
1236 DCHECK(!scope_info->HasContext() || context_->IsBlockContext()); | 1236 DCHECK(!scope_info->HasContext() || context_->IsBlockContext()); |
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2722 return Smi::FromInt(isolate->debug()->is_active()); | 2722 return Smi::FromInt(isolate->debug()->is_active()); |
2723 } | 2723 } |
2724 | 2724 |
2725 | 2725 |
2726 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { | 2726 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { |
2727 UNIMPLEMENTED(); | 2727 UNIMPLEMENTED(); |
2728 return NULL; | 2728 return NULL; |
2729 } | 2729 } |
2730 } | 2730 } |
2731 } // namespace v8::internal | 2731 } // namespace v8::internal |
OLD | NEW |