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