Commit ff9263f8 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[objects] Make Object::BooleanValue take an Isolate

Removes use of HeapObject::GetIsolate() from Object::BooleanValue in
preparation for removing the method.

Requires adding Isolate parameter to CommonOperatorReducer constructor.

Bug: v8:7786
Cq-Include-Trybots: luci.chromium.try:linux_chromium_rel_ng;luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: If735e71df3288bf1eb11576605c2d95a19472181
Reviewed-on: https://chromium-review.googlesource.com/1071653Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53361}
parent 7d161e4d
......@@ -3704,7 +3704,7 @@ MaybeLocal<Boolean> Value::ToBoolean(Local<Context> context) const {
auto obj = Utils::OpenHandle(this);
if (obj->IsBoolean()) return ToApiHandle<Boolean>(obj);
auto isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
auto val = isolate->factory()->ToBoolean(obj->BooleanValue());
auto val = isolate->factory()->ToBoolean(obj->BooleanValue(isolate));
return ToApiHandle<Boolean>(val);
}
......@@ -4018,12 +4018,17 @@ void v8::RegExp::CheckCast(v8::Value* that) {
Maybe<bool> Value::BooleanValue(Local<Context> context) const {
return Just(Utils::OpenHandle(this)->BooleanValue());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(context->GetIsolate());
return Just(Utils::OpenHandle(this)->BooleanValue(isolate));
}
bool Value::BooleanValue() const {
return Utils::OpenHandle(this)->BooleanValue();
auto obj = Utils::OpenHandle(this);
if (obj->IsSmi()) return *obj != i::Smi::kZero;
DCHECK(obj->IsHeapObject());
i::Isolate* isolate = i::Handle<i::HeapObject>::cast(obj)->GetIsolate();
return obj->BooleanValue(isolate);
}
......
......@@ -859,7 +859,7 @@ static Maybe<bool> IsConcatSpreadable(Isolate* isolate, Handle<Object> obj) {
MaybeHandle<Object> maybeValue =
i::Runtime::GetObjectProperty(isolate, obj, key);
if (!maybeValue.ToHandle(&value)) return Nothing<bool>();
if (!value->IsUndefined(isolate)) return Just(value->BooleanValue());
if (!value->IsUndefined(isolate)) return Just(value->BooleanValue(isolate));
}
return Object::IsArray(obj);
}
......
......@@ -18,7 +18,7 @@ BUILTIN(BooleanConstructor) {
HandleScope scope(isolate);
if (args.new_target()->IsUndefined(isolate)) { // [[Call]]
Handle<Object> value = args.atOrUndefined(isolate, 1);
return isolate->heap()->ToBoolean(value->BooleanValue());
return isolate->heap()->ToBoolean(value->BooleanValue(isolate));
} else { // [[Construct]]
HandleScope scope(isolate);
Handle<Object> value = args.atOrUndefined(isolate, 1);
......@@ -29,7 +29,7 @@ BUILTIN(BooleanConstructor) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
JSObject::New(target, new_target));
Handle<JSValue>::cast(result)->set_value(
isolate->heap()->ToBoolean(value->BooleanValue()));
isolate->heap()->ToBoolean(value->BooleanValue(isolate)));
return *result;
}
}
......
......@@ -19,7 +19,7 @@ namespace compiler {
namespace {
Decision DecideCondition(Node* const cond) {
Decision DecideCondition(Isolate* isolate, Node* const cond) {
switch (cond->opcode()) {
case IrOpcode::kInt32Constant: {
Int32Matcher mcond(cond);
......@@ -27,7 +27,8 @@ Decision DecideCondition(Node* const cond) {
}
case IrOpcode::kHeapConstant: {
HeapObjectMatcher mcond(cond);
return mcond.Value()->BooleanValue() ? Decision::kTrue : Decision::kFalse;
return mcond.Value()->BooleanValue(isolate) ? Decision::kTrue
: Decision::kFalse;
}
default:
return Decision::kUnknown;
......@@ -36,11 +37,13 @@ Decision DecideCondition(Node* const cond) {
} // namespace
CommonOperatorReducer::CommonOperatorReducer(Editor* editor, Graph* graph,
CommonOperatorReducer::CommonOperatorReducer(Isolate* isolate, Editor* editor,
Graph* graph,
CommonOperatorBuilder* common,
MachineOperatorBuilder* machine,
Zone* temp_zone)
: AdvancedReducer(editor),
isolate_(isolate),
graph_(graph),
common_(common),
machine_(machine),
......@@ -85,8 +88,8 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
// not (i.e. true being returned in the false case and vice versa).
if (cond->opcode() == IrOpcode::kBooleanNot ||
(cond->opcode() == IrOpcode::kSelect &&
DecideCondition(cond->InputAt(1)) == Decision::kFalse &&
DecideCondition(cond->InputAt(2)) == Decision::kTrue)) {
DecideCondition(isolate_, cond->InputAt(1)) == Decision::kFalse &&
DecideCondition(isolate_, cond->InputAt(2)) == Decision::kTrue)) {
for (Node* const use : node->uses()) {
switch (use->opcode()) {
case IrOpcode::kIfTrue:
......@@ -108,7 +111,7 @@ Reduction CommonOperatorReducer::ReduceBranch(Node* node) {
node, common()->Branch(NegateBranchHint(BranchHintOf(node->op()))));
return Changed(node);
}
Decision const decision = DecideCondition(cond);
Decision const decision = DecideCondition(isolate_, cond);
if (decision == Decision::kUnknown) return NoChange();
Node* const control = node->InputAt(1);
for (Node* const use : node->uses()) {
......@@ -148,7 +151,7 @@ Reduction CommonOperatorReducer::ReduceDeoptimizeConditional(Node* node) {
: common()->DeoptimizeUnless(p.kind(), p.reason(), p.feedback()));
return Changed(node);
}
Decision const decision = DecideCondition(condition);
Decision const decision = DecideCondition(isolate_, condition);
if (decision == Decision::kUnknown) return NoChange();
if (condition_is_true == (decision == Decision::kTrue)) {
ReplaceWithValue(node, dead(), effect, control);
......@@ -381,7 +384,7 @@ Reduction CommonOperatorReducer::ReduceSelect(Node* node) {
Node* const vtrue = node->InputAt(1);
Node* const vfalse = node->InputAt(2);
if (vtrue == vfalse) return Replace(vtrue);
switch (DecideCondition(cond)) {
switch (DecideCondition(isolate_, cond)) {
case Decision::kTrue:
return Replace(vtrue);
case Decision::kFalse:
......
......@@ -24,7 +24,7 @@ class Operator;
class V8_EXPORT_PRIVATE CommonOperatorReducer final
: public NON_EXPORTED_BASE(AdvancedReducer) {
public:
CommonOperatorReducer(Editor* editor, Graph* graph,
CommonOperatorReducer(Isolate* isolate, Editor* editor, Graph* graph,
CommonOperatorBuilder* common,
MachineOperatorBuilder* machine, Zone* temp_zone);
~CommonOperatorReducer() final {}
......@@ -51,6 +51,10 @@ class V8_EXPORT_PRIVATE CommonOperatorReducer final
MachineOperatorBuilder* machine() const { return machine_; }
Node* dead() const { return dead_; }
// TODO(mstarzinger): Remove the Isolate field, which is only required for
// HeapObject::BooleanValue. This field should not be used for any other
// purpose.
Isolate* isolate_;
Graph* const graph_;
CommonOperatorBuilder* const common_;
MachineOperatorBuilder* const machine_;
......
......@@ -981,9 +981,9 @@ PipelineWasmCompilationJob::ExecuteJobImpl() {
data->common(), scope.zone());
ValueNumberingReducer value_numbering(scope.zone(), data->graph()->zone());
MachineOperatorReducer machine_reducer(data->mcgraph(), asmjs_origin_);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
scope.zone());
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), scope.zone());
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &machine_reducer);
AddReducer(data, &graph_reducer, &common_reducer);
......@@ -1149,9 +1149,9 @@ struct InliningPhase {
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
CheckpointElimination checkpoint_elimination(&graph_reducer);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
JSCallReducer call_reducer(&graph_reducer, data->jsgraph(),
data->info()->is_bailout_on_uninitialized()
? JSCallReducer::kBailoutOnUninitialized
......@@ -1255,9 +1255,9 @@ struct TypedLoweringPhase {
&graph_reducer, data->info()->dependencies(), data->jsgraph());
SimplifiedOperatorReducer simple_reducer(&graph_reducer, data->jsgraph());
CheckpointElimination checkpoint_elimination(&graph_reducer);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &create_lowering);
AddReducer(data, &graph_reducer, &constant_folding_reducer);
......@@ -1372,9 +1372,9 @@ struct EarlyOptimizationPhase {
RedundancyElimination redundancy_elimination(&graph_reducer, temp_zone);
ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone());
MachineOperatorReducer machine_reducer(data->jsgraph());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &simple_reducer);
AddReducer(data, &graph_reducer, &redundancy_elimination);
......@@ -1443,9 +1443,9 @@ struct EffectControlLinearizationPhase {
data->jsgraph()->Dead());
DeadCodeElimination dead_code_elimination(&graph_reducer, data->graph(),
data->common(), temp_zone);
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
AddReducer(data, &graph_reducer, &dead_code_elimination);
AddReducer(data, &graph_reducer, &common_reducer);
graph_reducer.ReduceGraph();
......@@ -1481,9 +1481,9 @@ struct LoadEliminationPhase {
temp_zone);
CheckpointElimination checkpoint_elimination(&graph_reducer);
ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
ConstantFoldingReducer constant_folding_reducer(&graph_reducer,
data->jsgraph());
TypeNarrowingReducer type_narrowing_reducer(&graph_reducer,
......@@ -1533,9 +1533,9 @@ struct LateOptimizationPhase {
data->common(), temp_zone);
ValueNumberingReducer value_numbering(temp_zone, data->graph()->zone());
MachineOperatorReducer machine_reducer(data->jsgraph());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine(),
temp_zone);
CommonOperatorReducer common_reducer(data->isolate(), &graph_reducer,
data->graph(), data->common(),
data->machine(), temp_zone);
SelectLowering select_lowering(data->jsgraph()->graph(),
data->jsgraph()->common());
AddReducer(data, &graph_reducer, &branch_condition_elimination);
......
......@@ -57,7 +57,7 @@ Reduction SimplifiedOperatorReducer::Reduce(Node* node) {
}
case IrOpcode::kChangeTaggedToBit: {
HeapObjectMatcher m(node->InputAt(0));
if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue());
if (m.HasValue()) return ReplaceInt32(m.Value()->BooleanValue(isolate()));
if (m.IsChangeBitToTagged()) return Replace(m.InputAt(0));
break;
}
......
......@@ -164,7 +164,7 @@ static Maybe<bool> UnscopableLookup(LookupIterator* it) {
JSReceiver::GetProperty(Handle<JSReceiver>::cast(unscopables),
it->name()),
Nothing<bool>());
return Just(!blacklist->BooleanValue());
return Just(!blacklist->BooleanValue(isolate));
}
static PropertyAttributes GetAttributesForMode(VariableMode mode) {
......
......@@ -645,7 +645,7 @@ bool Debug::CheckBreakPoint(Handle<BreakPoint> break_point,
}
return false;
}
return result->BooleanValue();
return result->BooleanValue(isolate_);
}
bool Debug::SetBreakPoint(Handle<JSFunction> function,
......
......@@ -194,7 +194,7 @@ Object* EvalFromFunctionName(Isolate* isolate, Handle<Script> script) {
Handle<SharedFunctionInfo> shared(script->eval_from_shared());
// Find the name of the function calling eval.
if (shared->Name()->BooleanValue()) {
if (shared->Name()->BooleanValue(isolate)) {
return shared->Name();
}
......@@ -223,7 +223,7 @@ MaybeHandle<String> FormatEvalOrigin(Isolate* isolate, Handle<Script> script) {
Handle<Object> eval_from_function_name =
handle(EvalFromFunctionName(isolate, script), isolate);
if (eval_from_function_name->BooleanValue()) {
if (eval_from_function_name->BooleanValue(isolate)) {
Handle<String> str;
ASSIGN_RETURN_ON_EXCEPTION(
isolate, str, Object::ToString(isolate, eval_from_function_name),
......
......@@ -493,10 +493,9 @@ MaybeHandle<Object> Object::ConvertToIndex(
return js_len;
}
bool Object::BooleanValue() {
bool Object::BooleanValue(Isolate* isolate) {
if (IsSmi()) return Smi::ToInt(this) != 0;
DCHECK(IsHeapObject());
Isolate* isolate = HeapObject::cast(this)->GetIsolate();
if (IsBoolean()) return IsTrue(isolate);
if (IsNullOrUndefined(isolate)) return false;
if (IsUndetectable()) return false; // Undetectable object is false.
......@@ -806,7 +805,7 @@ MaybeHandle<Object> Object::InstanceOf(Isolate* isolate, Handle<Object> object,
isolate, result,
Execution::Call(isolate, inst_of_handler, callable, 1, &object),
Object);
return isolate->factory()->ToBoolean(result->BooleanValue());
return isolate->factory()->ToBoolean(result->BooleanValue(isolate));
}
// The {callable} must have a [[Call]] internal method.
......@@ -1637,8 +1636,8 @@ Maybe<bool> Object::SetPropertyWithAccessor(LookupIterator* it,
// (signalling an exception) or a boolean Oddball.
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Nothing<bool>());
if (result.is_null()) return Just(true);
DCHECK(result->BooleanValue() || should_throw == kDontThrow);
return Just(result->BooleanValue());
DCHECK(result->BooleanValue(isolate) || should_throw == kDontThrow);
return Just(result->BooleanValue(isolate));
}
// Regular accessor.
......@@ -5605,7 +5604,7 @@ Maybe<bool> JSProxy::HasProperty(Isolate* isolate, Handle<JSProxy> proxy,
isolate, trap_result_obj,
Execution::Call(isolate, trap, handler, arraysize(args), args),
Nothing<bool>());
bool boolean_trap_result = trap_result_obj->BooleanValue();
bool boolean_trap_result = trap_result_obj->BooleanValue(isolate);
// 9. If booleanTrapResult is false, then:
if (!boolean_trap_result) {
MAYBE_RETURN(JSProxy::CheckHasTrap(isolate, name, target), Nothing<bool>());
......@@ -5678,7 +5677,7 @@ Maybe<bool> JSProxy::SetProperty(Handle<JSProxy> proxy, Handle<Name> name,
isolate, trap_result,
Execution::Call(isolate, trap, handler, arraysize(args), args),
Nothing<bool>());
if (!trap_result->BooleanValue()) {
if (!trap_result->BooleanValue(isolate)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
trap_name, name));
......@@ -5726,7 +5725,7 @@ Maybe<bool> JSProxy::DeletePropertyOrElement(Handle<JSProxy> proxy,
isolate, trap_result,
Execution::Call(isolate, trap, handler, arraysize(args), args),
Nothing<bool>());
if (!trap_result->BooleanValue()) {
if (!trap_result->BooleanValue(isolate)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
trap_name, name));
......@@ -7556,7 +7555,7 @@ Maybe<bool> JSProxy::DefineOwnProperty(Isolate* isolate, Handle<JSProxy> proxy,
Execution::Call(isolate, trap, handler, arraysize(args), args),
Nothing<bool>());
// 10. If booleanTrapResult is false, return false.
if (!trap_result_obj->BooleanValue()) {
if (!trap_result_obj->BooleanValue(isolate)) {
RETURN_FAILURE(isolate, should_throw,
NewTypeError(MessageTemplate::kProxyTrapReturnedFalsishFor,
trap_name, property_name));
......@@ -8267,7 +8266,7 @@ Maybe<bool> JSProxy::PreventExtensions(Handle<JSProxy> proxy,
isolate, trap_result,
Execution::Call(isolate, trap, handler, arraysize(args), args),
Nothing<bool>());
if (!trap_result->BooleanValue()) {
if (!trap_result->BooleanValue(isolate)) {
RETURN_FAILURE(
isolate, should_throw,
NewTypeError(MessageTemplate::kProxyTrapReturnedFalsish, trap_name));
......@@ -8379,7 +8378,7 @@ Maybe<bool> JSProxy::IsExtensible(Handle<JSProxy> proxy) {
// Enforce the invariant.
Maybe<bool> target_result = JSReceiver::IsExtensible(target);
MAYBE_RETURN(target_result, Nothing<bool>());
if (target_result.FromJust() != trap_result->BooleanValue()) {
if (target_result.FromJust() != trap_result->BooleanValue(isolate)) {
isolate->Throw(
*factory->NewTypeError(MessageTemplate::kProxyIsExtensibleInconsistent,
factory->ToBoolean(target_result.FromJust())));
......@@ -15186,7 +15185,7 @@ Maybe<bool> JSProxy::SetPrototype(Handle<JSProxy> proxy, Handle<Object> value,
isolate, trap_result,
Execution::Call(isolate, trap, handler, arraysize(argv), argv),
Nothing<bool>());
bool bool_trap_result = trap_result->BooleanValue();
bool bool_trap_result = trap_result->BooleanValue(isolate);
// 9. If booleanTrapResult is false, return false.
if (!bool_trap_result) {
RETURN_FAILURE(
......
......@@ -1309,7 +1309,8 @@ class Object {
// implementation of a JSObject's elements.
inline bool HasValidElements();
bool BooleanValue(); // ECMA-262 9.2.
// ECMA-262 9.2.
bool BooleanValue(Isolate* isolate);
// ES6 section 7.2.11 Abstract Relational Comparison
V8_WARN_UNUSED_RESULT static Maybe<ComparisonResult> Compare(
......
......@@ -929,7 +929,7 @@ MaybeHandle<BigInt> BigInt::FromObject(Isolate* isolate, Handle<Object> obj) {
}
if (obj->IsBoolean()) {
return MutableBigInt::NewFromInt(isolate, obj->BooleanValue());
return MutableBigInt::NewFromInt(isolate, obj->BooleanValue(isolate));
}
if (obj->IsBigInt()) {
return Handle<BigInt>::cast(obj);
......
......@@ -83,7 +83,7 @@ bool ExtractBooleanSetting(Isolate* isolate, Handle<JSObject> options,
Handle<Object> object =
JSReceiver::GetProperty(options, str).ToHandleChecked();
if (object->IsBoolean()) {
*value = object->BooleanValue();
*value = object->BooleanValue(isolate);
return true;
}
return false;
......
......@@ -770,7 +770,7 @@ MaybeHandle<Object> Module::Evaluate(Handle<Module> module,
Object);
DCHECK(static_cast<JSIteratorResult*>(JSObject::cast(*result))
->done()
->BooleanValue());
->BooleanValue(isolate));
CHECK(MaybeTransitionComponent(module, stack, kEvaluated));
return handle(
......
......@@ -85,13 +85,13 @@ bool ToPropertyDescriptorFastPath(Isolate* isolate, Handle<JSReceiver> obj,
}
Heap* heap = isolate->heap();
if (key == heap->enumerable_string()) {
desc->set_enumerable(value->BooleanValue());
desc->set_enumerable(value->BooleanValue(isolate));
} else if (key == heap->configurable_string()) {
desc->set_configurable(value->BooleanValue());
desc->set_configurable(value->BooleanValue(isolate));
} else if (key == heap->value_string()) {
desc->set_value(value);
} else if (key == heap->writable_string()) {
desc->set_writable(value->BooleanValue());
desc->set_writable(value->BooleanValue(isolate));
} else if (key == heap->get_string()) {
// Bail out to slow path to throw an exception if necessary.
if (!value->IsCallable()) return false;
......@@ -212,7 +212,7 @@ bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate,
}
// 6c. Set the [[Enumerable]] field of desc to enum.
if (!enumerable.is_null()) {
desc->set_enumerable(enumerable->BooleanValue());
desc->set_enumerable(enumerable->BooleanValue(isolate));
}
// configurable?
......@@ -224,7 +224,7 @@ bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate,
}
// 9c. Set the [[Configurable]] field of desc to conf.
if (!configurable.is_null()) {
desc->set_configurable(configurable->BooleanValue());
desc->set_configurable(configurable->BooleanValue(isolate));
}
// value?
......@@ -245,7 +245,7 @@ bool PropertyDescriptor::ToPropertyDescriptor(Isolate* isolate,
return false;
}
// 15c. Set the [[Writable]] field of desc to writable.
if (!writable.is_null()) desc->set_writable(writable->BooleanValue());
if (!writable.is_null()) desc->set_writable(writable->BooleanValue(isolate));
// getter?
Handle<Object> getter;
......
......@@ -127,7 +127,7 @@ Maybe<bool> RegExpUtils::IsRegExp(Isolate* isolate, Handle<Object> object) {
JSObject::GetProperty(receiver, isolate->factory()->match_symbol()),
Nothing<bool>());
if (!match->IsUndefined(isolate)) return Just(match->BooleanValue());
if (!match->IsUndefined(isolate)) return Just(match->BooleanValue(isolate));
return Just(object->IsJSRegExp());
}
......
......@@ -241,19 +241,19 @@ MaybeHandle<Object> SetViewValue(Isolate* isolate, Handle<JSDataView> data_view,
} \
Handle<JSDataView> data_view = Handle<JSDataView>::cast(receiver);
#define DATA_VIEW_PROTOTYPE_GET(Type, type) \
RUNTIME_FUNCTION(Runtime_DataViewGet##Type) { \
HandleScope scope(isolate); \
CHECK_RECEIVER("DataView.prototype.get" #Type); \
Handle<Object> byte_offset = args.at<Object>(1); \
Handle<Object> is_little_endian = args.at<Object>(2); \
Handle<Object> result; \
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
isolate, result, \
GetViewValue<type>(isolate, data_view, byte_offset, \
is_little_endian->BooleanValue(), \
"DataView.prototype.get" #Type)); \
return *result; \
#define DATA_VIEW_PROTOTYPE_GET(Type, type) \
RUNTIME_FUNCTION(Runtime_DataViewGet##Type) { \
HandleScope scope(isolate); \
CHECK_RECEIVER("DataView.prototype.get" #Type); \
Handle<Object> byte_offset = args.at<Object>(1); \
Handle<Object> is_little_endian = args.at<Object>(2); \
Handle<Object> result; \
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
isolate, result, \
GetViewValue<type>(isolate, data_view, byte_offset, \
is_little_endian->BooleanValue(isolate), \
"DataView.prototype.get" #Type)); \
return *result; \
}
DATA_VIEW_PROTOTYPE_GET(Int8, int8_t)
......@@ -268,20 +268,20 @@ DATA_VIEW_PROTOTYPE_GET(BigInt64, int64_t)
DATA_VIEW_PROTOTYPE_GET(BigUint64, uint64_t)
#undef DATA_VIEW_PROTOTYPE_GET
#define DATA_VIEW_PROTOTYPE_SET(Type, type) \
RUNTIME_FUNCTION(Runtime_DataViewSet##Type) { \
HandleScope scope(isolate); \
CHECK_RECEIVER("DataView.prototype.set" #Type); \
Handle<Object> byte_offset = args.at<Object>(1); \
Handle<Object> value = args.at<Object>(2); \
Handle<Object> is_little_endian = args.at<Object>(3); \
Handle<Object> result; \
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
isolate, result, \
SetViewValue<type>(isolate, data_view, byte_offset, \
is_little_endian->BooleanValue(), value, \
"DataView.prototype.set" #Type)); \
return *result; \
#define DATA_VIEW_PROTOTYPE_SET(Type, type) \
RUNTIME_FUNCTION(Runtime_DataViewSet##Type) { \
HandleScope scope(isolate); \
CHECK_RECEIVER("DataView.prototype.set" #Type); \
Handle<Object> byte_offset = args.at<Object>(1); \
Handle<Object> value = args.at<Object>(2); \
Handle<Object> is_little_endian = args.at<Object>(3); \
Handle<Object> result; \
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( \
isolate, result, \
SetViewValue<type>(isolate, data_view, byte_offset, \
is_little_endian->BooleanValue(isolate), value, \
"DataView.prototype.set" #Type)); \
return *result; \
}
DATA_VIEW_PROTOTYPE_SET(Int8, int8_t)
......
......@@ -1186,7 +1186,8 @@ RUNTIME_FUNCTION(Runtime_CreateIterResultObject) {
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, value, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, done, 1);
return *isolate->factory()->NewJSIteratorResult(value, done->BooleanValue());
return *isolate->factory()->NewJSIteratorResult(value,
done->BooleanValue(isolate));
}
RUNTIME_FUNCTION(Runtime_CreateDataProperty) {
......
......@@ -146,7 +146,8 @@ RUNTIME_FUNCTION(Runtime_RejectPromise) {
CONVERT_ARG_HANDLE_CHECKED(JSPromise, promise, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, reason, 1);
CONVERT_ARG_HANDLE_CHECKED(Oddball, debug_event, 2);
return *JSPromise::Reject(promise, reason, debug_event->BooleanValue());
return *JSPromise::Reject(promise, reason,
debug_event->BooleanValue(isolate));
}
RUNTIME_FUNCTION(Runtime_ResolvePromise) {
......
......@@ -1756,7 +1756,7 @@ RUNTIME_FUNCTION(Runtime_RegExpReplace) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, global_obj,
JSReceiver::GetProperty(recv, factory->global_string()));
const bool global = global_obj->BooleanValue();
const bool global = global_obj->BooleanValue(isolate);
bool unicode = false;
if (global) {
......@@ -1764,7 +1764,7 @@ RUNTIME_FUNCTION(Runtime_RegExpReplace) {
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, unicode_obj,
JSReceiver::GetProperty(recv, factory->unicode_string()));
unicode = unicode_obj->BooleanValue();
unicode = unicode_obj->BooleanValue(isolate);
RETURN_FAILURE_ON_EXCEPTION(isolate,
RegExpUtils::SetLastIndex(isolate, recv, 0));
......
......@@ -1810,7 +1810,7 @@ TEST(InterpreterSmiComparisons) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(comparison, inputs[i], inputs[j]));
MaybeObject* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
......@@ -1859,7 +1859,7 @@ TEST(InterpreterHeapNumberComparisons) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(comparison, inputs[i], inputs[j]));
MaybeObject* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
......@@ -1948,7 +1948,7 @@ TEST(InterpreterStringComparisons) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(comparison, inputs[i], inputs[j]));
MaybeObject* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
......@@ -2063,7 +2063,7 @@ TEST(InterpreterMixedComparisons) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(comparison, lhs, rhs, true));
MaybeObject* feedback = callable.vector()->Get(slot);
CHECK(feedback->IsSmi());
......@@ -2104,7 +2104,7 @@ TEST(InterpreterStrictNotEqual) {
Handle<Object> return_value =
callable(lhs_obj, rhs_obj).ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(Token::Value::NE_STRICT, lhs, rhs, true));
}
}
......@@ -2121,7 +2121,7 @@ TEST(InterpreterStrictNotEqual) {
Handle<Object> return_value =
callable(lhs_obj, rhs_obj).ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(Token::Value::NE_STRICT, inputs_str[i], inputs_str[j]));
}
}
......@@ -2142,7 +2142,7 @@ TEST(InterpreterStrictNotEqual) {
Handle<Object> return_value =
callable(lhs_obj, rhs_obj).ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(),
CHECK_EQ(return_value->BooleanValue(isolate),
CompareC(Token::Value::NE_STRICT, inputs_number[i],
inputs_number[j]));
}
......@@ -2196,7 +2196,8 @@ TEST(InterpreterCompareTypeOf) {
for (size_t i = 0; i < arraysize(inputs); i++) {
Handle<Object> return_value = callable(inputs[i].first).ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(), inputs[i].second == literal_flag);
CHECK_EQ(return_value->BooleanValue(isolate),
inputs[i].second == literal_flag);
}
}
}
......@@ -2236,7 +2237,7 @@ TEST(InterpreterInstanceOf) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(), expected_value);
CHECK_EQ(return_value->BooleanValue(isolate), expected_value);
}
}
......@@ -2272,7 +2273,7 @@ TEST(InterpreterTestIn) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(), expected_value);
CHECK_EQ(return_value->BooleanValue(isolate), expected_value);
}
}
......@@ -2295,7 +2296,7 @@ TEST(InterpreterUnaryNot) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(), expected_value);
CHECK_EQ(return_value->BooleanValue(isolate), expected_value);
}
}
......@@ -2330,7 +2331,7 @@ TEST(InterpreterUnaryNotNonBoolean) {
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
CHECK_EQ(return_value->BooleanValue(), object_type_tuples[i].second);
CHECK_EQ(return_value->BooleanValue(isolate), object_type_tuples[i].second);
}
}
......@@ -2402,7 +2403,7 @@ TEST(InterpreterInvokeIntrinsic) {
Handle<Object> return_val = callable().ToHandleChecked();
CHECK(return_val->IsBoolean());
CHECK_EQ(return_val->BooleanValue(), false);
CHECK_EQ(return_val->BooleanValue(isolate), false);
}
TEST(InterpreterFunctionLiteral) {
......
......@@ -31,7 +31,8 @@ class CommonOperatorReducerTest : public GraphTest {
MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) {
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
flags);
CommonOperatorReducer reducer(editor, graph(), common(), &machine, zone());
CommonOperatorReducer reducer(isolate(), editor, graph(), common(),
&machine, zone());
return reducer.Reduce(node);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment