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/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1194 nested_scope_chain_.Add(scope_info); | 1194 nested_scope_chain_.Add(scope_info); |
1195 } | 1195 } |
1196 } else { | 1196 } else { |
1197 // Reparse the code and analyze the scopes. | 1197 // Reparse the code and analyze the scopes. |
1198 Handle<Script> script(Script::cast(shared_info->script())); | 1198 Handle<Script> script(Script::cast(shared_info->script())); |
1199 Scope* scope = NULL; | 1199 Scope* scope = NULL; |
1200 | 1200 |
1201 // Check whether we are in global, eval or function code. | 1201 // Check whether we are in global, eval or function code. |
1202 Handle<ScopeInfo> scope_info(shared_info->scope_info()); | 1202 Handle<ScopeInfo> scope_info(shared_info->scope_info()); |
1203 Zone zone; | 1203 Zone zone; |
1204 ParseInfo info(&zone); | |
1205 if (scope_info->scope_type() != FUNCTION_SCOPE && | 1204 if (scope_info->scope_type() != FUNCTION_SCOPE && |
1206 scope_info->scope_type() != ARROW_SCOPE) { | 1205 scope_info->scope_type() != ARROW_SCOPE) { |
1207 // Global or eval code. | 1206 // Global or eval code. |
1208 info.InitializeFromScript(script); | 1207 ParseInfo info(&zone, script); |
1209 if (scope_info->scope_type() == SCRIPT_SCOPE) { | 1208 if (scope_info->scope_type() == SCRIPT_SCOPE) { |
1210 info.set_global(); | 1209 info.set_global(); |
1211 } else { | 1210 } else { |
1212 DCHECK(scope_info->scope_type() == EVAL_SCOPE); | 1211 DCHECK(scope_info->scope_type() == EVAL_SCOPE); |
1213 info.set_eval(); | 1212 info.set_eval(); |
1214 info.set_context(Handle<Context>(function_->context())); | 1213 info.set_context(Handle<Context>(function_->context())); |
1215 } | 1214 } |
1216 if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) { | 1215 if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) { |
1217 scope = info.function()->scope(); | 1216 scope = info.function()->scope(); |
1218 } | 1217 } |
1219 RetrieveScopeChain(scope, shared_info); | 1218 RetrieveScopeChain(scope, shared_info); |
1220 } else { | 1219 } else { |
1221 // Function code | 1220 // Function code |
1222 info.InitializeFromSharedFunctionInfo(shared_info); | 1221 ParseInfo info(&zone, shared_info); |
1223 if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) { | 1222 if (Parser::ParseStatic(&info) && Scope::Analyze(&info)) { |
1224 scope = info.function()->scope(); | 1223 scope = info.function()->scope(); |
1225 } | 1224 } |
1226 RetrieveScopeChain(scope, shared_info); | 1225 RetrieveScopeChain(scope, shared_info); |
1227 } | 1226 } |
1228 } | 1227 } |
1229 } | 1228 } |
1230 | 1229 |
1231 ScopeIterator(Isolate* isolate, Handle<JSFunction> function) | 1230 ScopeIterator(Isolate* isolate, Handle<JSFunction> function) |
1232 : isolate_(isolate), | 1231 : isolate_(isolate), |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2812 return Smi::FromInt(isolate->debug()->is_active()); | 2811 return Smi::FromInt(isolate->debug()->is_active()); |
2813 } | 2812 } |
2814 | 2813 |
2815 | 2814 |
2816 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2815 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2817 UNIMPLEMENTED(); | 2816 UNIMPLEMENTED(); |
2818 return NULL; | 2817 return NULL; |
2819 } | 2818 } |
2820 } | 2819 } |
2821 } // namespace v8::internal | 2820 } // namespace v8::internal |
OLD | NEW |