| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 11209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11220 FrameInspector* frame_inspector) { | 11220 FrameInspector* frame_inspector) { |
| 11221 Handle<SharedFunctionInfo> shared(function->shared()); | 11221 Handle<SharedFunctionInfo> shared(function->shared()); |
| 11222 Handle<ScopeInfo> scope_info(shared->scope_info()); | 11222 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 11223 | 11223 |
| 11224 // First fill all parameters. | 11224 // First fill all parameters. |
| 11225 for (int i = 0; i < scope_info->ParameterCount(); ++i) { | 11225 for (int i = 0; i < scope_info->ParameterCount(); ++i) { |
| 11226 Handle<Object> value(i < frame_inspector->GetParametersCount() | 11226 Handle<Object> value(i < frame_inspector->GetParametersCount() |
| 11227 ? frame_inspector->GetParameter(i) | 11227 ? frame_inspector->GetParameter(i) |
| 11228 : isolate->heap()->undefined_value(), | 11228 : isolate->heap()->undefined_value(), |
| 11229 isolate); | 11229 isolate); |
| 11230 ASSERT(!value->IsTheHole()); |
| 11230 | 11231 |
| 11231 RETURN_IF_EMPTY_HANDLE_VALUE( | 11232 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 11232 isolate, | 11233 isolate, |
| 11233 SetProperty(isolate, | 11234 SetProperty(isolate, |
| 11234 target, | 11235 target, |
| 11235 Handle<String>(scope_info->ParameterName(i)), | 11236 Handle<String>(scope_info->ParameterName(i)), |
| 11236 value, | 11237 value, |
| 11237 NONE, | 11238 NONE, |
| 11238 kNonStrictMode), | 11239 kNonStrictMode), |
| 11239 Handle<JSObject>()); | 11240 Handle<JSObject>()); |
| 11240 } | 11241 } |
| 11241 | 11242 |
| 11242 // Second fill all stack locals. | 11243 // Second fill all stack locals. |
| 11243 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { | 11244 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
| 11245 Handle<Object> value(frame_inspector->GetExpression(i), isolate); |
| 11246 if (value->IsTheHole()) continue; |
| 11247 |
| 11244 RETURN_IF_EMPTY_HANDLE_VALUE( | 11248 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 11245 isolate, | 11249 isolate, |
| 11246 SetProperty(isolate, | 11250 SetProperty(isolate, |
| 11247 target, | 11251 target, |
| 11248 Handle<String>(scope_info->StackLocalName(i)), | 11252 Handle<String>(scope_info->StackLocalName(i)), |
| 11249 Handle<Object>(frame_inspector->GetExpression(i), isolate), | 11253 value, |
| 11250 NONE, | 11254 NONE, |
| 11251 kNonStrictMode), | 11255 kNonStrictMode), |
| 11252 Handle<JSObject>()); | 11256 Handle<JSObject>()); |
| 11253 } | 11257 } |
| 11254 | 11258 |
| 11255 return target; | 11259 return target; |
| 11256 } | 11260 } |
| 11257 | 11261 |
| 11258 | 11262 |
| 11259 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, | 11263 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, |
| 11260 Handle<JSObject> target, | 11264 Handle<JSObject> target, |
| 11261 Handle<JSFunction> function, | 11265 Handle<JSFunction> function, |
| 11262 JavaScriptFrame* frame, | 11266 JavaScriptFrame* frame, |
| 11263 int inlined_jsframe_index) { | 11267 int inlined_jsframe_index) { |
| 11264 if (inlined_jsframe_index != 0 || frame->is_optimized()) { | 11268 if (inlined_jsframe_index != 0 || frame->is_optimized()) { |
| 11265 // Optimized frames are not supported. | 11269 // Optimized frames are not supported. |
| 11266 // TODO(yangguo): make sure all code deoptimized when debugger is active | 11270 // TODO(yangguo): make sure all code deoptimized when debugger is active |
| 11267 // and assert that this cannot happen. | 11271 // and assert that this cannot happen. |
| 11268 return; | 11272 return; |
| 11269 } | 11273 } |
| 11270 | 11274 |
| 11271 Handle<SharedFunctionInfo> shared(function->shared()); | 11275 Handle<SharedFunctionInfo> shared(function->shared()); |
| 11272 Handle<ScopeInfo> scope_info(shared->scope_info()); | 11276 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 11273 | 11277 |
| 11274 // Parameters. | 11278 // Parameters. |
| 11275 for (int i = 0; i < scope_info->ParameterCount(); ++i) { | 11279 for (int i = 0; i < scope_info->ParameterCount(); ++i) { |
| 11280 ASSERT(!frame->GetParameter(i)->IsTheHole()); |
| 11276 HandleScope scope(isolate); | 11281 HandleScope scope(isolate); |
| 11277 Handle<Object> value = GetProperty( | 11282 Handle<Object> value = GetProperty( |
| 11278 isolate, target, Handle<String>(scope_info->ParameterName(i))); | 11283 isolate, target, Handle<String>(scope_info->ParameterName(i))); |
| 11279 frame->SetParameterValue(i, *value); | 11284 frame->SetParameterValue(i, *value); |
| 11280 } | 11285 } |
| 11281 | 11286 |
| 11282 // Stack locals. | 11287 // Stack locals. |
| 11283 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { | 11288 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
| 11289 if (frame->GetExpression(i)->IsTheHole()) continue; |
| 11284 HandleScope scope(isolate); | 11290 HandleScope scope(isolate); |
| 11285 Handle<Object> value = GetProperty( | 11291 Handle<Object> value = GetProperty( |
| 11286 isolate, target, Handle<String>(scope_info->StackLocalName(i))); | 11292 isolate, target, Handle<String>(scope_info->StackLocalName(i))); |
| 11287 frame->SetExpression(i, *value); | 11293 frame->SetExpression(i, *value); |
| 11288 } | 11294 } |
| 11289 } | 11295 } |
| 11290 | 11296 |
| 11291 | 11297 |
| 11292 static Handle<JSObject> MaterializeLocalContext(Isolate* isolate, | 11298 static Handle<JSObject> MaterializeLocalContext(Isolate* isolate, |
| 11293 Handle<JSObject> target, | 11299 Handle<JSObject> target, |
| (...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14475 // Handle last resort GC and make sure to allow future allocations | 14481 // Handle last resort GC and make sure to allow future allocations |
| 14476 // to grow the heap without causing GCs (if possible). | 14482 // to grow the heap without causing GCs (if possible). |
| 14477 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14483 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14478 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14484 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14479 "Runtime::PerformGC"); | 14485 "Runtime::PerformGC"); |
| 14480 } | 14486 } |
| 14481 } | 14487 } |
| 14482 | 14488 |
| 14483 | 14489 |
| 14484 } } // namespace v8::internal | 14490 } } // namespace v8::internal |
| OLD | NEW |