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