| 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/frames-inl.h" | 9 #include "src/frames-inl.h" |
| 10 #include "src/runtime/runtime-utils.h" | 10 #include "src/runtime/runtime-utils.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 Handle<JSObject>::cast(holder), name, value, attr)); | 349 Handle<JSObject>::cast(holder), name, value, attr)); |
| 350 | 350 |
| 351 return *value; | 351 return *value; |
| 352 } | 352 } |
| 353 | 353 |
| 354 | 354 |
| 355 static Handle<JSObject> NewSloppyArguments(Isolate* isolate, | 355 static Handle<JSObject> NewSloppyArguments(Isolate* isolate, |
| 356 Handle<JSFunction> callee, | 356 Handle<JSFunction> callee, |
| 357 Object** parameters, | 357 Object** parameters, |
| 358 int argument_count) { | 358 int argument_count) { |
| 359 CHECK(!IsSubclassConstructor(callee->shared()->kind())); | |
| 360 Handle<JSObject> result = | 359 Handle<JSObject> result = |
| 361 isolate->factory()->NewArgumentsObject(callee, argument_count); | 360 isolate->factory()->NewArgumentsObject(callee, argument_count); |
| 362 | 361 |
| 363 // Allocate the elements if needed. | 362 // Allocate the elements if needed. |
| 364 int parameter_count = callee->shared()->internal_formal_parameter_count(); | 363 int parameter_count = callee->shared()->formal_parameter_count(); |
| 365 if (argument_count > 0) { | 364 if (argument_count > 0) { |
| 366 if (parameter_count > 0) { | 365 if (parameter_count > 0) { |
| 367 int mapped_count = Min(argument_count, parameter_count); | 366 int mapped_count = Min(argument_count, parameter_count); |
| 368 Handle<FixedArray> parameter_map = | 367 Handle<FixedArray> parameter_map = |
| 369 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); | 368 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
| 370 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); | 369 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); |
| 371 | 370 |
| 372 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments"); | 371 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments"); |
| 373 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); | 372 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); |
| 374 | 373 |
| (...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1083 return Smi::FromInt(frame->GetArgumentsLength()); | 1082 return Smi::FromInt(frame->GetArgumentsLength()); |
| 1084 } | 1083 } |
| 1085 | 1084 |
| 1086 | 1085 |
| 1087 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1086 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
| 1088 SealHandleScope shs(isolate); | 1087 SealHandleScope shs(isolate); |
| 1089 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1088 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
| 1090 } | 1089 } |
| 1091 } | 1090 } |
| 1092 } // namespace v8::internal | 1091 } // namespace v8::internal |
| OLD | NEW |