| 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/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.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/ast/scopeinfo.h" | 9 #include "src/ast/scopeinfo.h" |
| 10 #include "src/ast/scopes.h" | 10 #include "src/ast/scopes.h" |
| (...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 HandleScope scope(isolate); | 633 HandleScope scope(isolate); |
| 634 DCHECK_EQ(1, args.length()); | 634 DCHECK_EQ(1, args.length()); |
| 635 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0) | 635 CONVERT_ARG_HANDLE_CHECKED(JSFunction, callee, 0) |
| 636 int start_index = callee->shared()->internal_formal_parameter_count(); | 636 int start_index = callee->shared()->internal_formal_parameter_count(); |
| 637 // This generic runtime function can also be used when the caller has been | 637 // This generic runtime function can also be used when the caller has been |
| 638 // inlined, we use the slow but accurate {GetCallerArguments}. | 638 // inlined, we use the slow but accurate {GetCallerArguments}. |
| 639 int argument_count = 0; | 639 int argument_count = 0; |
| 640 base::SmartArrayPointer<Handle<Object>> arguments = | 640 base::SmartArrayPointer<Handle<Object>> arguments = |
| 641 GetCallerArguments(isolate, &argument_count); | 641 GetCallerArguments(isolate, &argument_count); |
| 642 int num_elements = std::max(0, argument_count - start_index); | 642 int num_elements = std::max(0, argument_count - start_index); |
| 643 Handle<JSObject> result = isolate->factory()->NewJSArray( | 643 Handle<JSObject> result = |
| 644 FAST_ELEMENTS, num_elements, num_elements, Strength::WEAK, | 644 isolate->factory()->NewJSArray(FAST_ELEMENTS, num_elements, num_elements, |
| 645 DONT_INITIALIZE_ARRAY_ELEMENTS); | 645 DONT_INITIALIZE_ARRAY_ELEMENTS); |
| 646 { | 646 { |
| 647 DisallowHeapAllocation no_gc; | 647 DisallowHeapAllocation no_gc; |
| 648 FixedArray* elements = FixedArray::cast(result->elements()); | 648 FixedArray* elements = FixedArray::cast(result->elements()); |
| 649 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); | 649 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); |
| 650 for (int i = 0; i < num_elements; i++) { | 650 for (int i = 0; i < num_elements; i++) { |
| 651 elements->set(i, *arguments[i + start_index], mode); | 651 elements->set(i, *arguments[i + start_index], mode); |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 return *result; | 654 return *result; |
| 655 } | 655 } |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 DCHECK_EQ(2, args.length()); | 1132 DCHECK_EQ(2, args.length()); |
| 1133 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); | 1133 CONVERT_ARG_HANDLE_CHECKED(String, name, 0); |
| 1134 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); | 1134 CONVERT_ARG_HANDLE_CHECKED(Object, value, 1); |
| 1135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, | 1135 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, value, |
| 1136 StoreLookupSlot(name, value, STRICT)); | 1136 StoreLookupSlot(name, value, STRICT)); |
| 1137 return *value; | 1137 return *value; |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 } // namespace internal | 1140 } // namespace internal |
| 1141 } // namespace v8 | 1141 } // namespace v8 |
| OLD | NEW |