blob: 08511a0ac4a1d7fd35a75c0793b105f1fbf437e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/api/api-arguments.h"
#include "src/api/api-arguments-inl.h"
namespace v8 {
namespace internal {
PropertyCallbackArguments::PropertyCallbackArguments(
Isolate* isolate, Tagged<Object> data, Tagged<Object> self,
Tagged<JSObject> holder, Maybe<ShouldThrow> should_throw)
: Super(isolate)
#ifdef DEBUG
,
javascript_execution_counter_(isolate->javascript_execution_counter())
#endif // DEBUG
{
slot_at(T::kThisIndex).store(self);
slot_at(T::kHolderIndex).store(holder);
slot_at(T::kDataIndex).store(data);
slot_at(T::kIsolateIndex).store(Object(reinterpret_cast<Address>(isolate)));
int value = Internals::kInferShouldThrowMode;
if (should_throw.IsJust()) {
value = should_throw.FromJust();
}
slot_at(T::kShouldThrowOnErrorIndex).store(Smi::FromInt(value));
// Here the hole is set as default value.
// It cannot escape into js as it's removed in Call below.
Tagged<HeapObject> the_hole_value = ReadOnlyRoots(isolate).the_hole_value();
slot_at(T::kReturnValueIndex).store(the_hole_value);
slot_at(T::kUnusedIndex).store(Smi::zero());
DCHECK(IsHeapObject(*slot_at(T::kHolderIndex)));
DCHECK(IsSmi(*slot_at(T::kIsolateIndex)));
}
FunctionCallbackArguments::FunctionCallbackArguments(
internal::Isolate* isolate, internal::Tagged<internal::Object> data,
internal::Tagged<internal::Object> holder,
internal::Tagged<internal::HeapObject> new_target, internal::Address* argv,
int argc)
: Super(isolate), argv_(argv), argc_(argc) {
slot_at(T::kDataIndex).store(data);
slot_at(T::kHolderIndex).store(holder);
slot_at(T::kNewTargetIndex).store(new_target);
slot_at(T::kIsolateIndex).store(Object(reinterpret_cast<Address>(isolate)));
// Here the hole is set as default value. It's converted to and not
// directly exposed to js.
// TODO(cbruni): Remove and/or use custom sentinel value.
Tagged<HeapObject> the_hole_value = ReadOnlyRoots(isolate).the_hole_value();
slot_at(T::kReturnValueIndex).store(the_hole_value);
slot_at(T::kUnusedIndex).store(Smi::zero());
DCHECK(IsHeapObject(*slot_at(T::kHolderIndex)));
DCHECK(IsSmi(*slot_at(T::kIsolateIndex)));
}
} // namespace internal
} // namespace v8
|