OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/api.h" | 8 #include "src/api.h" |
9 #include "src/contexts.h" | 9 #include "src/contexts.h" |
10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 // Accessors::FunctionArguments | 1109 // Accessors::FunctionArguments |
1110 // | 1110 // |
1111 | 1111 |
1112 | 1112 |
1113 static Handle<Object> ArgumentsForInlinedFunction( | 1113 static Handle<Object> ArgumentsForInlinedFunction( |
1114 JavaScriptFrame* frame, | 1114 JavaScriptFrame* frame, |
1115 Handle<JSFunction> inlined_function, | 1115 Handle<JSFunction> inlined_function, |
1116 int inlined_frame_index) { | 1116 int inlined_frame_index) { |
1117 Isolate* isolate = inlined_function->GetIsolate(); | 1117 Isolate* isolate = inlined_function->GetIsolate(); |
1118 Factory* factory = isolate->factory(); | 1118 Factory* factory = isolate->factory(); |
| 1119 SlotRefValueBuilder slot_refs( |
| 1120 frame, inlined_frame_index, |
| 1121 inlined_function->shared()->internal_formal_parameter_count()); |
1119 | 1122 |
1120 TranslatedState translated_values(frame); | 1123 int args_count = slot_refs.args_length(); |
1121 translated_values.Prepare(false, frame->fp()); | |
1122 | |
1123 int argument_count = 0; | |
1124 TranslatedFrame* translated_frame = | |
1125 translated_values.GetArgumentsInfoFromJSFrameIndex(inlined_frame_index, | |
1126 &argument_count); | |
1127 TranslatedFrame::iterator iter = translated_frame->begin(); | |
1128 | |
1129 // Skip the receiver. | |
1130 iter++; | |
1131 argument_count--; | |
1132 | |
1133 Handle<JSObject> arguments = | 1124 Handle<JSObject> arguments = |
1134 factory->NewArgumentsObject(inlined_function, argument_count); | 1125 factory->NewArgumentsObject(inlined_function, args_count); |
1135 Handle<FixedArray> array = factory->NewFixedArray(argument_count); | 1126 Handle<FixedArray> array = factory->NewFixedArray(args_count); |
1136 bool should_deoptimize = false; | 1127 slot_refs.Prepare(isolate); |
1137 for (int i = 0; i < argument_count; ++i) { | 1128 for (int i = 0; i < args_count; ++i) { |
1138 // If we materialize any object, we should deopt because we might alias | 1129 Handle<Object> value = slot_refs.GetNext(isolate, 0); |
1139 // an object that was eliminated by escape analysis. | |
1140 should_deoptimize = should_deoptimize || iter->IsMaterializedObject(); | |
1141 Handle<Object> value = iter->GetValue(); | |
1142 array->set(i, *value); | 1130 array->set(i, *value); |
1143 iter++; | |
1144 } | 1131 } |
| 1132 slot_refs.Finish(isolate); |
1145 arguments->set_elements(*array); | 1133 arguments->set_elements(*array); |
1146 | 1134 |
1147 if (should_deoptimize) { | |
1148 translated_values.StoreMaterializedValuesAndDeopt(); | |
1149 } | |
1150 | |
1151 // Return the freshly allocated arguments object. | 1135 // Return the freshly allocated arguments object. |
1152 return arguments; | 1136 return arguments; |
1153 } | 1137 } |
1154 | 1138 |
1155 | 1139 |
1156 static int FindFunctionInFrame(JavaScriptFrame* frame, | 1140 static int FindFunctionInFrame(JavaScriptFrame* frame, |
1157 Handle<JSFunction> function) { | 1141 Handle<JSFunction> function) { |
1158 DisallowHeapAllocation no_allocation; | 1142 DisallowHeapAllocation no_allocation; |
1159 List<JSFunction*> functions(2); | 1143 List<JSFunction*> functions(2); |
1160 frame->GetFunctions(&functions); | 1144 frame->GetFunctions(&functions); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1469 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1453 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
1470 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1454 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
1471 info->set_getter(*getter); | 1455 info->set_getter(*getter); |
1472 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1456 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
1473 return info; | 1457 return info; |
1474 } | 1458 } |
1475 | 1459 |
1476 | 1460 |
1477 } // namespace internal | 1461 } // namespace internal |
1478 } // namespace v8 | 1462 } // namespace v8 |
OLD | NEW |