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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 | 340 |
341 // Allocate the elements if needed. | 341 // Allocate the elements if needed. |
342 int parameter_count = callee->shared()->formal_parameter_count(); | 342 int parameter_count = callee->shared()->formal_parameter_count(); |
343 if (argument_count > 0) { | 343 if (argument_count > 0) { |
344 if (parameter_count > 0) { | 344 if (parameter_count > 0) { |
345 int mapped_count = Min(argument_count, parameter_count); | 345 int mapped_count = Min(argument_count, parameter_count); |
346 Handle<FixedArray> parameter_map = | 346 Handle<FixedArray> parameter_map = |
347 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); | 347 isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED); |
348 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); | 348 parameter_map->set_map(isolate->heap()->sloppy_arguments_elements_map()); |
349 | 349 |
350 Handle<Map> map = Map::Copy(handle(result->map())); | 350 Handle<Map> map = Map::Copy(handle(result->map()), "NewSloppyArguments"); |
351 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); | 351 map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS); |
352 | 352 |
353 result->set_map(*map); | 353 result->set_map(*map); |
354 result->set_elements(*parameter_map); | 354 result->set_elements(*parameter_map); |
355 | 355 |
356 // Store the context and the arguments array at the beginning of the | 356 // Store the context and the arguments array at the beginning of the |
357 // parameter map. | 357 // parameter map. |
358 Handle<Context> context(isolate->context()); | 358 Handle<Context> context(isolate->context()); |
359 Handle<FixedArray> arguments = | 359 Handle<FixedArray> arguments = |
360 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); | 360 isolate->factory()->NewFixedArray(argument_count, NOT_TENURED); |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1019 return Smi::FromInt(frame->GetArgumentsLength()); | 1019 return Smi::FromInt(frame->GetArgumentsLength()); |
1020 } | 1020 } |
1021 | 1021 |
1022 | 1022 |
1023 RUNTIME_FUNCTION(RuntimeReference_Arguments) { | 1023 RUNTIME_FUNCTION(RuntimeReference_Arguments) { |
1024 SealHandleScope shs(isolate); | 1024 SealHandleScope shs(isolate); |
1025 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); | 1025 return __RT_impl_Runtime_GetArgumentsProperty(args, isolate); |
1026 } | 1026 } |
1027 } | 1027 } |
1028 } // namespace v8::internal | 1028 } // namespace v8::internal |
OLD | NEW |