Line data Source code
1 : // Copyright 2018 the V8 project authors. All rights reserved.
2 : // Use of this source code is governed by a BSD-style license that can be
3 : // found in the LICENSE file.
4 :
5 : #include "src/api-arguments.h"
6 :
7 : #include "src/api-arguments-inl.h"
8 :
9 : namespace v8 {
10 : namespace internal {
11 :
12 2619990 : PropertyCallbackArguments::PropertyCallbackArguments(Isolate* isolate,
13 : Object data, Object self,
14 : JSObject holder,
15 : ShouldThrow should_throw)
16 2619990 : : Super(isolate) {
17 : slot_at(T::kThisIndex).store(self);
18 : slot_at(T::kHolderIndex).store(holder);
19 : slot_at(T::kDataIndex).store(data);
20 2619990 : slot_at(T::kIsolateIndex).store(Object(reinterpret_cast<Address>(isolate)));
21 : slot_at(T::kShouldThrowOnErrorIndex)
22 2619990 : .store(Smi::FromInt(should_throw == kThrowOnError ? 1 : 0));
23 :
24 : // Here the hole is set as default value.
25 : // It cannot escape into js as it's removed in Call below.
26 : HeapObject the_hole = ReadOnlyRoots(isolate).the_hole_value();
27 : slot_at(T::kReturnValueDefaultValueIndex).store(the_hole);
28 : slot_at(T::kReturnValueIndex).store(the_hole);
29 : DCHECK((*slot_at(T::kHolderIndex))->IsHeapObject());
30 : DCHECK((*slot_at(T::kIsolateIndex))->IsSmi());
31 2619991 : }
32 :
33 2475045 : FunctionCallbackArguments::FunctionCallbackArguments(
34 : internal::Isolate* isolate, internal::Object data,
35 : internal::HeapObject callee, internal::Object holder,
36 : internal::HeapObject new_target, internal::Address* argv, int argc)
37 2475045 : : Super(isolate), argv_(argv), argc_(argc) {
38 : slot_at(T::kDataIndex).store(data);
39 : slot_at(T::kHolderIndex).store(holder);
40 : slot_at(T::kNewTargetIndex).store(new_target);
41 2475045 : slot_at(T::kIsolateIndex).store(Object(reinterpret_cast<Address>(isolate)));
42 : // Here the hole is set as default value.
43 : // It cannot escape into js as it's remove in Call below.
44 : HeapObject the_hole = ReadOnlyRoots(isolate).the_hole_value();
45 : slot_at(T::kReturnValueDefaultValueIndex).store(the_hole);
46 : slot_at(T::kReturnValueIndex).store(the_hole);
47 : DCHECK((*slot_at(T::kHolderIndex))->IsHeapObject());
48 : DCHECK((*slot_at(T::kIsolateIndex))->IsSmi());
49 2475058 : }
50 :
51 : } // namespace internal
52 183867 : } // namespace v8
|