| 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/accessors.h" | 5 #include "src/accessors.h" |
| 6 | 6 |
| 7 #include "src/api.h" | 7 #include "src/api.h" |
| 8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/execution.h" | 10 #include "src/execution.h" |
| (...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 if (function_index < 0) continue; | 1168 if (function_index < 0) continue; |
| 1169 | 1169 |
| 1170 if (function_index > 0) { | 1170 if (function_index > 0) { |
| 1171 // The function in question was inlined. Inlined functions have the | 1171 // The function in question was inlined. Inlined functions have the |
| 1172 // correct number of arguments and no allocated arguments object, so | 1172 // correct number of arguments and no allocated arguments object, so |
| 1173 // we can construct a fresh one by interpreting the function's | 1173 // we can construct a fresh one by interpreting the function's |
| 1174 // deoptimization input data. | 1174 // deoptimization input data. |
| 1175 return ArgumentsForInlinedFunction(frame, function, function_index); | 1175 return ArgumentsForInlinedFunction(frame, function, function_index); |
| 1176 } | 1176 } |
| 1177 | 1177 |
| 1178 if (!frame->is_optimized()) { | 1178 // Find the frame that holds the actual arguments passed to the function. |
| 1179 // If there is an arguments variable in the stack, we return that. | |
| 1180 Handle<ScopeInfo> scope_info(function->shared()->scope_info()); | |
| 1181 int index = scope_info->StackSlotIndex( | |
| 1182 isolate->heap()->arguments_string()); | |
| 1183 if (index >= 0) { | |
| 1184 Handle<Object> arguments(frame->GetExpression(index), isolate); | |
| 1185 if (!arguments->IsArgumentsMarker()) return arguments; | |
| 1186 } | |
| 1187 } | |
| 1188 | |
| 1189 // If there is no arguments variable in the stack or we have an | |
| 1190 // optimized frame, we find the frame that holds the actual arguments | |
| 1191 // passed to the function. | |
| 1192 it.AdvanceToArgumentsFrame(); | 1179 it.AdvanceToArgumentsFrame(); |
| 1193 frame = it.frame(); | 1180 frame = it.frame(); |
| 1194 | 1181 |
| 1195 // Get the number of arguments and construct an arguments object | 1182 // Get the number of arguments and construct an arguments object |
| 1196 // mirror for the right frame. | 1183 // mirror for the right frame. |
| 1197 const int length = frame->ComputeParametersCount(); | 1184 const int length = frame->ComputeParametersCount(); |
| 1198 Handle<JSObject> arguments = isolate->factory()->NewArgumentsObject( | 1185 Handle<JSObject> arguments = isolate->factory()->NewArgumentsObject( |
| 1199 function, length); | 1186 function, length); |
| 1200 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); | 1187 Handle<FixedArray> array = isolate->factory()->NewFixedArray(length); |
| 1201 | 1188 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1480 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); | 1467 Handle<Object> getter = v8::FromCData(isolate, &ModuleGetExport); |
| 1481 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); | 1468 Handle<Object> setter = v8::FromCData(isolate, &ModuleSetExport); |
| 1482 info->set_getter(*getter); | 1469 info->set_getter(*getter); |
| 1483 if (!(attributes & ReadOnly)) info->set_setter(*setter); | 1470 if (!(attributes & ReadOnly)) info->set_setter(*setter); |
| 1484 return info; | 1471 return info; |
| 1485 } | 1472 } |
| 1486 | 1473 |
| 1487 | 1474 |
| 1488 } // namespace internal | 1475 } // namespace internal |
| 1489 } // namespace v8 | 1476 } // namespace v8 |
| OLD | NEW |