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())); |
359 Handle<JSObject> result = | 360 Handle<JSObject> result = |
360 isolate->factory()->NewArgumentsObject(callee, argument_count); | 361 isolate->factory()->NewArgumentsObject(callee, argument_count); |
361 | 362 |
362 // Allocate the elements if needed. | 363 // Allocate the elements if needed. |
363 int parameter_count = callee->shared()->formal_parameter_count(); | 364 int parameter_count = callee->shared()->internal_formal_parameter_count(); |
364 if (argument_count > 0) { | 365 if (argument_count > 0) { |
365 if (parameter_count > 0) { | 366 if (parameter_count > 0) { |
366 int mapped_count = Min(argument_count, parameter_count); | 367 int mapped_count = Min(argument_count, parameter_count); |
367 Handle<FixedArray> parameter_map = | 368 Handle<FixedArray> parameter_map = |
368 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); | 369 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
369 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); | 370 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); |
370 | 371 |
371 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments"); | 372 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments"); |
372 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); | 373 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); |
373 | 374 |
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 return Smi::FromInt(frame->GetArgumentsLength()); | 1083 return Smi::FromInt(frame->GetArgumentsLength()); |
1083 } | 1084 } |
1084 | 1085 |
1085 | 1086 |
1086 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1087 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
1087 SealHandleScope shs(isolate); | 1088 SealHandleScope shs(isolate); |
1088 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1089 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1089 } | 1090 } |
1090 } | 1091 } |
1091 } // namespace v8::internal | 1092 } // namespace v8::internal |
OLD | NEW |