| 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 11346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11357 static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( | 11357 static Handle<JSObject> MaterializeStackLocalsWithFrameInspector( |
| 11358 Isolate* isolate, | 11358 Isolate* isolate, |
| 11359 Handle<JSObject> target, | 11359 Handle<JSObject> target, |
| 11360 Handle<JSFunction> function, | 11360 Handle<JSFunction> function, |
| 11361 FrameInspector* frame_inspector) { | 11361 FrameInspector* frame_inspector) { |
| 11362 Handle<SharedFunctionInfo> shared(function->shared()); | 11362 Handle<SharedFunctionInfo> shared(function->shared()); |
| 11363 Handle<ScopeInfo> scope_info(shared->scope_info()); | 11363 Handle<ScopeInfo> scope_info(shared->scope_info()); |
| 11364 | 11364 |
| 11365 // First fill all parameters. | 11365 // First fill all parameters. |
| 11366 for (int i = 0; i < scope_info->ParameterCount(); ++i) { | 11366 for (int i = 0; i < scope_info->ParameterCount(); ++i) { |
| 11367 Handle<String> name(scope_info->ParameterName(i)); |
| 11368 VariableMode mode; |
| 11369 InitializationFlag init_flag; |
| 11370 // Do not materialize the parameter if it is shadowed by a context local. |
| 11371 if (scope_info->ContextSlotIndex(*name, &mode, &init_flag) != -1) continue; |
| 11372 |
| 11367 Handle<Object> value(i < frame_inspector->GetParametersCount() | 11373 Handle<Object> value(i < frame_inspector->GetParametersCount() |
| 11368 ? frame_inspector->GetParameter(i) | 11374 ? frame_inspector->GetParameter(i) |
| 11369 : isolate->heap()->undefined_value(), | 11375 : isolate->heap()->undefined_value(), |
| 11370 isolate); | 11376 isolate); |
| 11371 ASSERT(!value->IsTheHole()); | 11377 ASSERT(!value->IsTheHole()); |
| 11372 | 11378 |
| 11373 RETURN_IF_EMPTY_HANDLE_VALUE( | 11379 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 11374 isolate, | 11380 isolate, |
| 11375 Runtime::SetObjectProperty(isolate, | 11381 Runtime::SetObjectProperty( |
| 11376 target, | 11382 isolate, target, name, value, NONE, kNonStrictMode), |
| 11377 Handle<String>(scope_info->ParameterName(i)), | |
| 11378 value, | |
| 11379 NONE, | |
| 11380 kNonStrictMode), | |
| 11381 Handle<JSObject>()); | 11383 Handle<JSObject>()); |
| 11382 } | 11384 } |
| 11383 | 11385 |
| 11384 // Second fill all stack locals. | 11386 // Second fill all stack locals. |
| 11385 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { | 11387 for (int i = 0; i < scope_info->StackLocalCount(); ++i) { |
| 11388 Handle<String> name(scope_info->StackLocalName(i)); |
| 11386 Handle<Object> value(frame_inspector->GetExpression(i), isolate); | 11389 Handle<Object> value(frame_inspector->GetExpression(i), isolate); |
| 11387 if (value->IsTheHole()) continue; | 11390 if (value->IsTheHole()) continue; |
| 11388 | 11391 |
| 11389 RETURN_IF_EMPTY_HANDLE_VALUE( | 11392 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 11390 isolate, | 11393 isolate, |
| 11391 Runtime::SetObjectProperty( | 11394 Runtime::SetObjectProperty( |
| 11392 isolate, | 11395 isolate, target, name, value, NONE, kNonStrictMode), |
| 11393 target, | |
| 11394 Handle<String>(scope_info->StackLocalName(i)), | |
| 11395 value, | |
| 11396 NONE, | |
| 11397 kNonStrictMode), | |
| 11398 Handle<JSObject>()); | 11396 Handle<JSObject>()); |
| 11399 } | 11397 } |
| 11400 | |
| 11401 return target; | 11398 return target; |
| 11402 } | 11399 } |
| 11403 | 11400 |
| 11404 | 11401 |
| 11405 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, | 11402 static void UpdateStackLocalsFromMaterializedObject(Isolate* isolate, |
| 11406 Handle<JSObject> target, | 11403 Handle<JSObject> target, |
| 11407 Handle<JSFunction> function, | 11404 Handle<JSFunction> function, |
| 11408 JavaScriptFrame* frame, | 11405 JavaScriptFrame* frame, |
| 11409 int inlined_jsframe_index) { | 11406 int inlined_jsframe_index) { |
| 11410 if (inlined_jsframe_index != 0 || frame->is_optimized()) { | 11407 if (inlined_jsframe_index != 0 || frame->is_optimized()) { |
| (...skipping 3482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14893 // Handle last resort GC and make sure to allow future allocations | 14890 // Handle last resort GC and make sure to allow future allocations |
| 14894 // to grow the heap without causing GCs (if possible). | 14891 // to grow the heap without causing GCs (if possible). |
| 14895 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14892 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14893 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14897 "Runtime::PerformGC"); | 14894 "Runtime::PerformGC"); |
| 14898 } | 14895 } |
| 14899 } | 14896 } |
| 14900 | 14897 |
| 14901 | 14898 |
| 14902 } } // namespace v8::internal | 14899 } } // namespace v8::internal |
| OLD | NEW |