Commit 87a65911 authored by jkummerow's avatar jkummerow Committed by Commit bot

Reland of [refactoring] Split CodeAssemblerState out of CodeAssembler

This is in preparation for introducing more specialized
CodeStubAssembler subclasses. The state object can be handed
around, while the Assembler instances are temporary-scoped.

BUG=v8:5628

Original review: https://codereview.chromium.org/2498073002/

Review-Url: https://codereview.chromium.org/2502293002
Cr-Commit-Position: refs/heads/master@{#41028}
parent c93bdaaf
This diff is collapsed.
......@@ -34,28 +34,32 @@ BUILTIN(BooleanConstructor_ConstructStub) {
}
// ES6 section 19.3.3.2 Boolean.prototype.toString ( )
void Builtins::Generate_BooleanPrototypeToString(CodeStubAssembler* assembler) {
void Builtins::Generate_BooleanPrototypeToString(
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(0);
Node* context = assembler->Parameter(3);
Node* receiver = assembler.Parameter(0);
Node* context = assembler.Parameter(3);
Node* value = assembler->ToThisValue(
Node* value = assembler.ToThisValue(
context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.toString");
Node* result = assembler->LoadObjectField(value, Oddball::kToStringOffset);
assembler->Return(result);
Node* result = assembler.LoadObjectField(value, Oddball::kToStringOffset);
assembler.Return(result);
}
// ES6 section 19.3.3.3 Boolean.prototype.valueOf ( )
void Builtins::Generate_BooleanPrototypeValueOf(CodeStubAssembler* assembler) {
void Builtins::Generate_BooleanPrototypeValueOf(
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(0);
Node* context = assembler->Parameter(3);
Node* receiver = assembler.Parameter(0);
Node* context = assembler.Parameter(3);
Node* result = assembler->ToThisValue(
Node* result = assembler.ToThisValue(
context, receiver, PrimitiveType::kBoolean, "Boolean.prototype.valueOf");
assembler->Return(result);
assembler.Return(result);
}
} // namespace internal
......
This diff is collapsed.
......@@ -908,9 +908,10 @@ BUILTIN(DatePrototypeToJson) {
}
}
// static
void Builtins::Generate_DatePrototype_GetField(CodeStubAssembler* assembler,
int field_index) {
namespace {
void Generate_DatePrototype_GetField(CodeStubAssembler* assembler,
int field_index) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
......@@ -965,100 +966,132 @@ void Builtins::Generate_DatePrototype_GetField(CodeStubAssembler* assembler,
}
}
} // namespace
// static
void Builtins::Generate_DatePrototypeGetDate(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kDay);
void Builtins::Generate_DatePrototypeGetDate(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kDay);
}
// static
void Builtins::Generate_DatePrototypeGetDay(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kWeekday);
void Builtins::Generate_DatePrototypeGetDay(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kWeekday);
}
// static
void Builtins::Generate_DatePrototypeGetFullYear(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kYear);
void Builtins::Generate_DatePrototypeGetFullYear(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kYear);
}
// static
void Builtins::Generate_DatePrototypeGetHours(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kHour);
void Builtins::Generate_DatePrototypeGetHours(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kHour);
}
// static
void Builtins::Generate_DatePrototypeGetMilliseconds(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMillisecond);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecond);
}
// static
void Builtins::Generate_DatePrototypeGetMinutes(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMinute);
void Builtins::Generate_DatePrototypeGetMinutes(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMinute);
}
// static
void Builtins::Generate_DatePrototypeGetMonth(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMonth);
void Builtins::Generate_DatePrototypeGetMonth(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMonth);
}
// static
void Builtins::Generate_DatePrototypeGetSeconds(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kSecond);
void Builtins::Generate_DatePrototypeGetSeconds(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kSecond);
}
// static
void Builtins::Generate_DatePrototypeGetTime(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kDateValue);
void Builtins::Generate_DatePrototypeGetTime(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kDateValue);
}
// static
void Builtins::Generate_DatePrototypeGetTimezoneOffset(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kTimezoneOffset);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kTimezoneOffset);
}
// static
void Builtins::Generate_DatePrototypeGetUTCDate(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kDayUTC);
void Builtins::Generate_DatePrototypeGetUTCDate(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kDayUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCDay(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kWeekdayUTC);
void Builtins::Generate_DatePrototypeGetUTCDay(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kWeekdayUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCFullYear(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kYearUTC);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kYearUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCHours(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kHourUTC);
void Builtins::Generate_DatePrototypeGetUTCHours(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kHourUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCMilliseconds(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMillisecondUTC);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMillisecondUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCMinutes(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMinuteUTC);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMinuteUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCMonth(CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kMonthUTC);
void Builtins::Generate_DatePrototypeGetUTCMonth(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kMonthUTC);
}
// static
void Builtins::Generate_DatePrototypeGetUTCSeconds(
CodeStubAssembler* assembler) {
Generate_DatePrototype_GetField(assembler, JSDate::kSecondUTC);
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_DatePrototype_GetField(&assembler, JSDate::kSecondUTC);
}
} // namespace internal
......
......@@ -283,14 +283,15 @@ BUILTIN(FunctionPrototypeToString) {
// ES6 section 19.2.3.6 Function.prototype [ @@hasInstance ] ( V )
void Builtins::Generate_FunctionPrototypeHasInstance(
CodeStubAssembler* assembler) {
compiler::CodeAssemblerState* state) {
using compiler::Node;
CodeStubAssembler assembler(state);
Node* f = assembler->Parameter(0);
Node* v = assembler->Parameter(1);
Node* context = assembler->Parameter(4);
Node* result = assembler->OrdinaryHasInstance(context, f, v);
assembler->Return(result);
Node* f = assembler.Parameter(0);
Node* v = assembler.Parameter(1);
Node* context = assembler.Parameter(4);
Node* result = assembler.OrdinaryHasInstance(context, f, v);
assembler.Return(result);
}
} // namespace internal
......
......@@ -96,20 +96,26 @@ void Generate_GeneratorPrototypeResume(
} // anonymous namespace
// ES6 section 25.3.1.2 Generator.prototype.next ( value )
void Builtins::Generate_GeneratorPrototypeNext(CodeStubAssembler* assembler) {
Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kNext,
void Builtins::Generate_GeneratorPrototypeNext(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_GeneratorPrototypeResume(&assembler, JSGeneratorObject::kNext,
"[Generator].prototype.next");
}
// ES6 section 25.3.1.3 Generator.prototype.return ( value )
void Builtins::Generate_GeneratorPrototypeReturn(CodeStubAssembler* assembler) {
Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kReturn,
void Builtins::Generate_GeneratorPrototypeReturn(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_GeneratorPrototypeResume(&assembler, JSGeneratorObject::kReturn,
"[Generator].prototype.return");
}
// ES6 section 25.3.1.4 Generator.prototype.throw ( exception )
void Builtins::Generate_GeneratorPrototypeThrow(CodeStubAssembler* assembler) {
Generate_GeneratorPrototypeResume(assembler, JSGeneratorObject::kThrow,
void Builtins::Generate_GeneratorPrototypeThrow(
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
Generate_GeneratorPrototypeResume(&assembler, JSGeneratorObject::kThrow,
"[Generator].prototype.throw");
}
......
......@@ -101,111 +101,112 @@ BUILTIN(GlobalEval) {
}
// ES6 section 18.2.2 isFinite ( number )
void Builtins::Generate_GlobalIsFinite(CodeStubAssembler* assembler) {
void Builtins::Generate_GlobalIsFinite(compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
CodeStubAssembler assembler(state);
Node* context = assembler->Parameter(4);
Node* context = assembler.Parameter(4);
Label return_true(assembler), return_false(assembler);
Label return_true(&assembler), return_false(&assembler);
// We might need to loop once for ToNumber conversion.
Variable var_num(assembler, MachineRepresentation::kTagged);
Label loop(assembler, &var_num);
var_num.Bind(assembler->Parameter(1));
assembler->Goto(&loop);
assembler->Bind(&loop);
Variable var_num(&assembler, MachineRepresentation::kTagged);
Label loop(&assembler, &var_num);
var_num.Bind(assembler.Parameter(1));
assembler.Goto(&loop);
assembler.Bind(&loop);
{
// Load the current {num} value.
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
assembler->GotoIf(assembler->TaggedIsSmi(num), &return_true);
assembler.GotoIf(assembler.TaggedIsSmi(num), &return_true);
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(assembler),
if_numisnotheapnumber(assembler, Label::kDeferred);
assembler->Branch(assembler->WordEqual(assembler->LoadMap(num),
assembler->HeapNumberMapConstant()),
&if_numisheapnumber, &if_numisnotheapnumber);
Label if_numisheapnumber(&assembler),
if_numisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
assembler.HeapNumberMapConstant()),
&if_numisheapnumber, &if_numisnotheapnumber);
assembler->Bind(&if_numisheapnumber);
assembler.Bind(&if_numisheapnumber);
{
// Check if {num} contains a finite, non-NaN value.
Node* num_value = assembler->LoadHeapNumberValue(num);
assembler->BranchIfFloat64IsNaN(
assembler->Float64Sub(num_value, num_value), &return_false,
&return_true);
Node* num_value = assembler.LoadHeapNumberValue(num);
assembler.BranchIfFloat64IsNaN(assembler.Float64Sub(num_value, num_value),
&return_false, &return_true);
}
assembler->Bind(&if_numisnotheapnumber);
assembler.Bind(&if_numisnotheapnumber);
{
// Need to convert {num} to a Number first.
Callable callable = CodeFactory::NonNumberToNumber(assembler->isolate());
var_num.Bind(assembler->CallStub(callable, context, num));
assembler->Goto(&loop);
Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate());
var_num.Bind(assembler.CallStub(callable, context, num));
assembler.Goto(&loop);
}
}
assembler->Bind(&return_true);
assembler->Return(assembler->BooleanConstant(true));
assembler.Bind(&return_true);
assembler.Return(assembler.BooleanConstant(true));
assembler->Bind(&return_false);
assembler->Return(assembler->BooleanConstant(false));
assembler.Bind(&return_false);
assembler.Return(assembler.BooleanConstant(false));
}
// ES6 section 18.2.3 isNaN ( number )
void Builtins::Generate_GlobalIsNaN(CodeStubAssembler* assembler) {
void Builtins::Generate_GlobalIsNaN(compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CodeStubAssembler::Variable Variable;
CodeStubAssembler assembler(state);
Node* context = assembler->Parameter(4);
Node* context = assembler.Parameter(4);
Label return_true(assembler), return_false(assembler);
Label return_true(&assembler), return_false(&assembler);
// We might need to loop once for ToNumber conversion.
Variable var_num(assembler, MachineRepresentation::kTagged);
Label loop(assembler, &var_num);
var_num.Bind(assembler->Parameter(1));
assembler->Goto(&loop);
assembler->Bind(&loop);
Variable var_num(&assembler, MachineRepresentation::kTagged);
Label loop(&assembler, &var_num);
var_num.Bind(assembler.Parameter(1));
assembler.Goto(&loop);
assembler.Bind(&loop);
{
// Load the current {num} value.
Node* num = var_num.value();
// Check if {num} is a Smi or a HeapObject.
assembler->GotoIf(assembler->TaggedIsSmi(num), &return_false);
assembler.GotoIf(assembler.TaggedIsSmi(num), &return_false);
// Check if {num} is a HeapNumber.
Label if_numisheapnumber(assembler),
if_numisnotheapnumber(assembler, Label::kDeferred);
assembler->Branch(assembler->WordEqual(assembler->LoadMap(num),
assembler->HeapNumberMapConstant()),
&if_numisheapnumber, &if_numisnotheapnumber);
Label if_numisheapnumber(&assembler),
if_numisnotheapnumber(&assembler, Label::kDeferred);
assembler.Branch(assembler.WordEqual(assembler.LoadMap(num),
assembler.HeapNumberMapConstant()),
&if_numisheapnumber, &if_numisnotheapnumber);
assembler->Bind(&if_numisheapnumber);
assembler.Bind(&if_numisheapnumber);
{
// Check if {num} contains a NaN.
Node* num_value = assembler->LoadHeapNumberValue(num);
assembler->BranchIfFloat64IsNaN(num_value, &return_true, &return_false);
Node* num_value = assembler.LoadHeapNumberValue(num);
assembler.BranchIfFloat64IsNaN(num_value, &return_true, &return_false);
}
assembler->Bind(&if_numisnotheapnumber);
assembler.Bind(&if_numisnotheapnumber);
{
// Need to convert {num} to a Number first.
Callable callable = CodeFactory::NonNumberToNumber(assembler->isolate());
var_num.Bind(assembler->CallStub(callable, context, num));
assembler->Goto(&loop);
Callable callable = CodeFactory::NonNumberToNumber(assembler.isolate());
var_num.Bind(assembler.CallStub(callable, context, num));
assembler.Goto(&loop);
}
}
assembler->Bind(&return_true);
assembler->Return(assembler->BooleanConstant(true));
assembler.Bind(&return_true);
assembler.Return(assembler.BooleanConstant(true));
assembler->Bind(&return_false);
assembler->Return(assembler->BooleanConstant(false));
assembler.Bind(&return_false);
assembler.Return(assembler.BooleanConstant(false));
}
} // namespace internal
......
......@@ -12,18 +12,19 @@ namespace v8 {
namespace internal {
void Builtins::Generate_KeyedLoadIC_Megamorphic_TF(
CodeStubAssembler* assembler) {
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
CodeStubAssembler::LoadICParameters p(context, receiver, name, slot, vector);
assembler->KeyedLoadICGeneric(&p);
assembler.KeyedLoadICGeneric(&p);
}
void Builtins::Generate_KeyedLoadIC_Miss(MacroAssembler* masm) {
......@@ -41,30 +42,14 @@ void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict(MacroAssembler* masm) {
KeyedStoreIC::GenerateMegamorphic(masm, STRICT);
}
void KeyedStoreICMegamorphic(CodeStubAssembler* assembler, LanguageMode mode) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(Descriptor::kValue);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
CodeStubAssembler::StoreICParameters p(context, receiver, name, value, slot,
vector);
KeyedStoreGenericGenerator::Generate(assembler, &p, mode);
}
void Builtins::Generate_KeyedStoreIC_Megamorphic_TF(
CodeStubAssembler* assembler) {
KeyedStoreICMegamorphic(assembler, SLOPPY);
compiler::CodeAssemblerState* state) {
KeyedStoreGenericGenerator::Generate(state, SLOPPY);
}
void Builtins::Generate_KeyedStoreIC_Megamorphic_Strict_TF(
CodeStubAssembler* assembler) {
KeyedStoreICMegamorphic(assembler, STRICT);
compiler::CodeAssemblerState* state) {
KeyedStoreGenericGenerator::Generate(state, STRICT);
}
void Builtins::Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
......@@ -75,76 +60,79 @@ void Builtins::Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
KeyedStoreIC::GenerateSlow(masm);
}
void Builtins::Generate_LoadGlobalIC_Miss(CodeStubAssembler* assembler) {
void Builtins::Generate_LoadGlobalIC_Miss(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot,
vector);
assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Miss, context, slot, vector);
}
void Builtins::Generate_LoadGlobalIC_Slow(CodeStubAssembler* assembler) {
void Builtins::Generate_LoadGlobalIC_Slow(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadGlobalWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, slot,
vector);
assembler.TailCallRuntime(Runtime::kLoadGlobalIC_Slow, context, slot, vector);
}
void Builtins::Generate_LoadIC_Getter_ForDeopt(MacroAssembler* masm) {
NamedLoadHandlerCompiler::GenerateLoadViaGetterForDeopt(masm);
}
void Builtins::Generate_LoadIC_Miss(CodeStubAssembler* assembler) {
void Builtins::Generate_LoadIC_Miss(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name,
slot, vector);
assembler.TailCallRuntime(Runtime::kLoadIC_Miss, context, receiver, name,
slot, vector);
}
void Builtins::Generate_LoadIC_Normal(MacroAssembler* masm) {
LoadIC::GenerateNormal(masm);
}
void Builtins::Generate_LoadIC_Slow(CodeStubAssembler* assembler) {
void Builtins::Generate_LoadIC_Slow(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef LoadWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* context = assembler.Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
assembler.TailCallRuntime(Runtime::kGetProperty, context, receiver, name);
}
void Builtins::Generate_StoreIC_Miss(CodeStubAssembler* assembler) {
void Builtins::Generate_StoreIC_Miss(compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(Descriptor::kValue);
Node* slot = assembler->Parameter(Descriptor::kSlot);
Node* vector = assembler->Parameter(Descriptor::kVector);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* value = assembler.Parameter(Descriptor::kValue);
Node* slot = assembler.Parameter(Descriptor::kSlot);
Node* vector = assembler.Parameter(Descriptor::kVector);
Node* context = assembler.Parameter(Descriptor::kContext);
assembler->TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
vector, receiver, name);
assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
vector, receiver, name);
}
void Builtins::Generate_StoreIC_Normal(MacroAssembler* masm) {
......@@ -156,30 +144,33 @@ void Builtins::Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
}
namespace {
void Generate_StoreIC_Slow(CodeStubAssembler* assembler,
void Generate_StoreIC_Slow(compiler::CodeAssemblerState* state,
LanguageMode language_mode) {
typedef compiler::Node Node;
typedef StoreWithVectorDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(Descriptor::kReceiver);
Node* name = assembler->Parameter(Descriptor::kName);
Node* value = assembler->Parameter(Descriptor::kValue);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* lang_mode = assembler->SmiConstant(Smi::FromInt(language_mode));
Node* receiver = assembler.Parameter(Descriptor::kReceiver);
Node* name = assembler.Parameter(Descriptor::kName);
Node* value = assembler.Parameter(Descriptor::kValue);
Node* context = assembler.Parameter(Descriptor::kContext);
Node* lang_mode = assembler.SmiConstant(Smi::FromInt(language_mode));
// The slow case calls into the runtime to complete the store without causing
// an IC miss that would otherwise cause a transition to the generic stub.
assembler->TailCallRuntime(Runtime::kSetProperty, context, receiver, name,
value, lang_mode);
assembler.TailCallRuntime(Runtime::kSetProperty, context, receiver, name,
value, lang_mode);
}
} // anonymous namespace
void Builtins::Generate_StoreIC_SlowSloppy(CodeStubAssembler* assembler) {
Generate_StoreIC_Slow(assembler, SLOPPY);
void Builtins::Generate_StoreIC_SlowSloppy(
compiler::CodeAssemblerState* state) {
Generate_StoreIC_Slow(state, SLOPPY);
}
void Builtins::Generate_StoreIC_SlowStrict(CodeStubAssembler* assembler) {
Generate_StoreIC_Slow(assembler, STRICT);
void Builtins::Generate_StoreIC_SlowStrict(
compiler::CodeAssemblerState* state) {
Generate_StoreIC_Slow(state, STRICT);
}
} // namespace internal
......
......@@ -54,86 +54,90 @@ void Builtins::Generate_StackCheck(MacroAssembler* masm) {
// TurboFan support builtins.
void Builtins::Generate_CopyFastSmiOrObjectElements(
CodeStubAssembler* assembler) {
compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef CopyFastSmiOrObjectElementsDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* object = assembler->Parameter(Descriptor::kObject);
Node* object = assembler.Parameter(Descriptor::kObject);
// Load the {object}s elements.
Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset);
Node* source = assembler.LoadObjectField(object, JSObject::kElementsOffset);
CodeStubAssembler::ParameterMode mode = assembler->OptimalParameterMode();
Node* length = assembler->UntagParameter(
assembler->LoadFixedArrayBaseLength(source), mode);
CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode();
Node* length = assembler.UntagParameter(
assembler.LoadFixedArrayBaseLength(source), mode);
// Check if we can allocate in new space.
ElementsKind kind = FAST_ELEMENTS;
int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind);
Label if_newspace(assembler), if_oldspace(assembler);
assembler->Branch(
assembler->UintPtrLessThan(
length, assembler->IntPtrOrSmiConstant(max_elements, mode)),
Label if_newspace(&assembler), if_oldspace(&assembler);
assembler.Branch(
assembler.UintPtrLessThan(
length, assembler.IntPtrOrSmiConstant(max_elements, mode)),
&if_newspace, &if_oldspace);
assembler->Bind(&if_newspace);
assembler.Bind(&if_newspace);
{
Node* target = assembler->AllocateFixedArray(kind, length, mode);
assembler->CopyFixedArrayElements(kind, source, target, length,
SKIP_WRITE_BARRIER, mode);
assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
assembler->Return(target);
Node* target = assembler.AllocateFixedArray(kind, length, mode);
assembler.CopyFixedArrayElements(kind, source, target, length,
SKIP_WRITE_BARRIER, mode);
assembler.StoreObjectField(object, JSObject::kElementsOffset, target);
assembler.Return(target);
}
assembler->Bind(&if_oldspace);
assembler.Bind(&if_oldspace);
{
Node* target = assembler->AllocateFixedArray(
kind, length, mode, CodeStubAssembler::kPretenured);
assembler->CopyFixedArrayElements(kind, source, target, length,
UPDATE_WRITE_BARRIER, mode);
assembler->StoreObjectField(object, JSObject::kElementsOffset, target);
assembler->Return(target);
Node* target = assembler.AllocateFixedArray(kind, length, mode,
CodeStubAssembler::kPretenured);
assembler.CopyFixedArrayElements(kind, source, target, length,
UPDATE_WRITE_BARRIER, mode);
assembler.StoreObjectField(object, JSObject::kElementsOffset, target);
assembler.Return(target);
}
}
void Builtins::Generate_GrowFastDoubleElements(CodeStubAssembler* assembler) {
void Builtins::Generate_GrowFastDoubleElements(
compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef GrowArrayElementsDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* object = assembler->Parameter(Descriptor::kObject);
Node* key = assembler->Parameter(Descriptor::kKey);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* object = assembler.Parameter(Descriptor::kObject);
Node* key = assembler.Parameter(Descriptor::kKey);
Node* context = assembler.Parameter(Descriptor::kContext);
Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
Node* elements = assembler->LoadElements(object);
elements = assembler->TryGrowElementsCapacity(
Label runtime(&assembler, CodeStubAssembler::Label::kDeferred);
Node* elements = assembler.LoadElements(object);
elements = assembler.TryGrowElementsCapacity(
object, elements, FAST_DOUBLE_ELEMENTS, key, &runtime);
assembler->Return(elements);
assembler.Return(elements);
assembler->Bind(&runtime);
assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
assembler.Bind(&runtime);
assembler.TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
}
void Builtins::Generate_GrowFastSmiOrObjectElements(
CodeStubAssembler* assembler) {
compiler::CodeAssemblerState* state) {
typedef CodeStubAssembler::Label Label;
typedef compiler::Node Node;
typedef GrowArrayElementsDescriptor Descriptor;
CodeStubAssembler assembler(state);
Node* object = assembler->Parameter(Descriptor::kObject);
Node* key = assembler->Parameter(Descriptor::kKey);
Node* context = assembler->Parameter(Descriptor::kContext);
Node* object = assembler.Parameter(Descriptor::kObject);
Node* key = assembler.Parameter(Descriptor::kKey);
Node* context = assembler.Parameter(Descriptor::kContext);
Label runtime(assembler, CodeStubAssembler::Label::kDeferred);
Node* elements = assembler->LoadElements(object);
elements = assembler->TryGrowElementsCapacity(object, elements, FAST_ELEMENTS,
key, &runtime);
assembler->Return(elements);
Label runtime(&assembler, CodeStubAssembler::Label::kDeferred);
Node* elements = assembler.LoadElements(object);
elements = assembler.TryGrowElementsCapacity(object, elements, FAST_ELEMENTS,
key, &runtime);
assembler.Return(elements);
assembler->Bind(&runtime);
assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
assembler.Bind(&runtime);
assembler.TailCallRuntime(Runtime::kGrowArrayElements, context, object, key);
}
} // namespace internal
......
......@@ -10,8 +10,9 @@ namespace v8 {
namespace internal {
void Builtins::Generate_IteratorPrototypeIterator(
CodeStubAssembler* assembler) {
assembler->Return(assembler->Parameter(0));
compiler::CodeAssemblerState* state) {
CodeStubAssembler assembler(state);
assembler.Return(assembler.Parameter(0));
}
BUILTIN(ModuleNamespaceIterator) {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -31,7 +31,7 @@ void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged,
compiler::Node* context,
compiler::Node** out_instance_type,
compiler::Node** out_backing_store) {
using namespace compiler;
using compiler::Node;
CodeStubAssembler::Label is_smi(a), not_smi(a), is_typed_array(a),
not_typed_array(a), is_shared(a), not_shared(a), is_float_or_clamped(a),
not_float_or_clamped(a), invalid(a);
......@@ -95,7 +95,7 @@ void ValidateSharedTypedArray(CodeStubAssembler* a, compiler::Node* tagged,
compiler::Node* ConvertTaggedAtomicIndexToWord32(CodeStubAssembler* a,
compiler::Node* tagged,
compiler::Node* context) {
using namespace compiler;
using compiler::Node;
CodeStubAssembler::Variable var_result(a, MachineRepresentation::kWord32);
Callable to_number = CodeFactory::ToNumber(a->isolate());
......@@ -139,7 +139,7 @@ compiler::Node* ConvertTaggedAtomicIndexToWord32(CodeStubAssembler* a,
void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word,
compiler::Node* array_length_word,
compiler::Node* context) {
using namespace compiler;
using compiler::Node;
// Check if the index is in bounds. If not, throw RangeError.
CodeStubAssembler::Label if_inbounds(a), if_notinbounds(a);
// TODO(jkummerow): Use unsigned comparison instead of "i<0 || i>length".
......@@ -155,24 +155,25 @@ void ValidateAtomicIndex(CodeStubAssembler* a, compiler::Node* index_word,
} // anonymous namespace
void Builtins::Generate_AtomicsLoad(CodeStubAssembler* a) {
using namespace compiler;
Node* array = a->Parameter(1);
Node* index = a->Parameter(2);
Node* context = a->Parameter(3 + 2);
void Builtins::Generate_AtomicsLoad(compiler::CodeAssemblerState* state) {
using compiler::Node;
CodeStubAssembler a(state);
Node* array = a.Parameter(1);
Node* index = a.Parameter(2);
Node* context = a.Parameter(3 + 2);
Node* instance_type;
Node* backing_store;
ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
ValidateSharedTypedArray(&a, array, context, &instance_type, &backing_store);
Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
Node* array_length_word32 = a->TruncateTaggedToWord32(
context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
ValidateAtomicIndex(a, index_word32, array_length_word32, context);
Node* index_word = a->ChangeUint32ToWord(index_word32);
Node* index_word32 = ConvertTaggedAtomicIndexToWord32(&a, index, context);
Node* array_length_word32 = a.TruncateTaggedToWord32(
context, a.LoadObjectField(array, JSTypedArray::kLengthOffset));
ValidateAtomicIndex(&a, index_word32, array_length_word32, context);
Node* index_word = a.ChangeUint32ToWord(index_word32);
CodeStubAssembler::Label i8(a), u8(a), i16(a), u16(a), i32(a), u32(a),
other(a);
CodeStubAssembler::Label i8(&a), u8(&a), i16(&a), u16(&a), i32(&a), u32(&a),
other(&a);
int32_t case_values[] = {
FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
......@@ -180,59 +181,60 @@ void Builtins::Generate_AtomicsLoad(CodeStubAssembler* a) {
CodeStubAssembler::Label* case_labels[] = {
&i8, &u8, &i16, &u16, &i32, &u32,
};
a->Switch(instance_type, &other, case_values, case_labels,
arraysize(case_labels));
a.Switch(instance_type, &other, case_values, case_labels,
arraysize(case_labels));
a->Bind(&i8);
a->Return(
a->SmiTag(a->AtomicLoad(MachineType::Int8(), backing_store, index_word)));
a.Bind(&i8);
a.Return(
a.SmiTag(a.AtomicLoad(MachineType::Int8(), backing_store, index_word)));
a->Bind(&u8);
a->Return(a->SmiTag(
a->AtomicLoad(MachineType::Uint8(), backing_store, index_word)));
a.Bind(&u8);
a.Return(
a.SmiTag(a.AtomicLoad(MachineType::Uint8(), backing_store, index_word)));
a->Bind(&i16);
a->Return(a->SmiTag(a->AtomicLoad(MachineType::Int16(), backing_store,
a->WordShl(index_word, 1))));
a.Bind(&i16);
a.Return(a.SmiTag(a.AtomicLoad(MachineType::Int16(), backing_store,
a.WordShl(index_word, 1))));
a->Bind(&u16);
a->Return(a->SmiTag(a->AtomicLoad(MachineType::Uint16(), backing_store,
a->WordShl(index_word, 1))));
a.Bind(&u16);
a.Return(a.SmiTag(a.AtomicLoad(MachineType::Uint16(), backing_store,
a.WordShl(index_word, 1))));
a->Bind(&i32);
a->Return(a->ChangeInt32ToTagged(a->AtomicLoad(
MachineType::Int32(), backing_store, a->WordShl(index_word, 2))));
a.Bind(&i32);
a.Return(a.ChangeInt32ToTagged(a.AtomicLoad(
MachineType::Int32(), backing_store, a.WordShl(index_word, 2))));
a->Bind(&u32);
a->Return(a->ChangeUint32ToTagged(a->AtomicLoad(
MachineType::Uint32(), backing_store, a->WordShl(index_word, 2))));
a.Bind(&u32);
a.Return(a.ChangeUint32ToTagged(a.AtomicLoad(
MachineType::Uint32(), backing_store, a.WordShl(index_word, 2))));
// This shouldn't happen, we've already validated the type.
a->Bind(&other);
a->Return(a->Int32Constant(0));
a.Bind(&other);
a.Return(a.Int32Constant(0));
}
void Builtins::Generate_AtomicsStore(CodeStubAssembler* a) {
using namespace compiler;
Node* array = a->Parameter(1);
Node* index = a->Parameter(2);
Node* value = a->Parameter(3);
Node* context = a->Parameter(4 + 2);
void Builtins::Generate_AtomicsStore(compiler::CodeAssemblerState* state) {
using compiler::Node;
CodeStubAssembler a(state);
Node* array = a.Parameter(1);
Node* index = a.Parameter(2);
Node* value = a.Parameter(3);
Node* context = a.Parameter(4 + 2);
Node* instance_type;
Node* backing_store;
ValidateSharedTypedArray(a, array, context, &instance_type, &backing_store);
ValidateSharedTypedArray(&a, array, context, &instance_type, &backing_store);
Node* index_word32 = ConvertTaggedAtomicIndexToWord32(a, index, context);
Node* array_length_word32 = a->TruncateTaggedToWord32(
context, a->LoadObjectField(array, JSTypedArray::kLengthOffset));
ValidateAtomicIndex(a, index_word32, array_length_word32, context);
Node* index_word = a->ChangeUint32ToWord(index_word32);
Node* index_word32 = ConvertTaggedAtomicIndexToWord32(&a, index, context);
Node* array_length_word32 = a.TruncateTaggedToWord32(
context, a.LoadObjectField(array, JSTypedArray::kLengthOffset));
ValidateAtomicIndex(&a, index_word32, array_length_word32, context);
Node* index_word = a.ChangeUint32ToWord(index_word32);
Node* value_integer = a->ToInteger(context, value);
Node* value_word32 = a->TruncateTaggedToWord32(context, value_integer);
Node* value_integer = a.ToInteger(context, value);
Node* value_word32 = a.TruncateTaggedToWord32(context, value_integer);
CodeStubAssembler::Label u8(a), u16(a), u32(a), other(a);
CodeStubAssembler::Label u8(&a), u16(&a), u32(&a), other(&a);
int32_t case_values[] = {
FIXED_INT8_ARRAY_TYPE, FIXED_UINT8_ARRAY_TYPE, FIXED_INT16_ARRAY_TYPE,
FIXED_UINT16_ARRAY_TYPE, FIXED_INT32_ARRAY_TYPE, FIXED_UINT32_ARRAY_TYPE,
......@@ -240,27 +242,27 @@ void Builtins::Generate_AtomicsStore(CodeStubAssembler* a) {
CodeStubAssembler::Label* case_labels[] = {
&u8, &u8, &u16, &u16, &u32, &u32,
};
a->Switch(instance_type, &other, case_values, case_labels,
arraysize(case_labels));
a.Switch(instance_type, &other, case_values, case_labels,
arraysize(case_labels));
a->Bind(&u8);
a->AtomicStore(MachineRepresentation::kWord8, backing_store, index_word,
value_word32);
a->Return(value_integer);
a.Bind(&u8);
a.AtomicStore(MachineRepresentation::kWord8, backing_store, index_word,
value_word32);
a.Return(value_integer);
a->Bind(&u16);
a->AtomicStore(MachineRepresentation::kWord16, backing_store,
a->WordShl(index_word, 1), value_word32);
a->Return(value_integer);
a.Bind(&u16);
a.AtomicStore(MachineRepresentation::kWord16, backing_store,
a.WordShl(index_word, 1), value_word32);
a.Return(value_integer);
a->Bind(&u32);
a->AtomicStore(MachineRepresentation::kWord32, backing_store,
a->WordShl(index_word, 2), value_word32);
a->Return(value_integer);
a.Bind(&u32);
a.AtomicStore(MachineRepresentation::kWord32, backing_store,
a.WordShl(index_word, 2), value_word32);
a.Return(value_integer);
// This shouldn't happen, we've already validated the type.
a->Bind(&other);
a->Return(a->Int32Constant(0));
a.Bind(&other);
a.Return(a.Int32Constant(0));
}
} // namespace internal
......
This diff is collapsed.
......@@ -34,42 +34,47 @@ BUILTIN(SymbolConstructor_ConstructStub) {
// ES6 section 19.4.3.4 Symbol.prototype [ @@toPrimitive ] ( hint )
void Builtins::Generate_SymbolPrototypeToPrimitive(
CodeStubAssembler* assembler) {
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(0);
Node* context = assembler->Parameter(4);
Node* receiver = assembler.Parameter(0);
Node* context = assembler.Parameter(4);
Node* result =
assembler->ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype [ @@toPrimitive ]");
assembler->Return(result);
assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype [ @@toPrimitive ]");
assembler.Return(result);
}
// ES6 section 19.4.3.2 Symbol.prototype.toString ( )
void Builtins::Generate_SymbolPrototypeToString(CodeStubAssembler* assembler) {
void Builtins::Generate_SymbolPrototypeToString(
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(0);
Node* context = assembler->Parameter(3);
Node* receiver = assembler.Parameter(0);
Node* context = assembler.Parameter(3);
Node* value = assembler->ToThisValue(
context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.toString");
Node* value = assembler.ToThisValue(context, receiver, PrimitiveType::kSymbol,
"Symbol.prototype.toString");
Node* result =
assembler->CallRuntime(Runtime::kSymbolDescriptiveString, context, value);
assembler->Return(result);
assembler.CallRuntime(Runtime::kSymbolDescriptiveString, context, value);
assembler.Return(result);
}
// ES6 section 19.4.3.3 Symbol.prototype.valueOf ( )
void Builtins::Generate_SymbolPrototypeValueOf(CodeStubAssembler* assembler) {
void Builtins::Generate_SymbolPrototypeValueOf(
compiler::CodeAssemblerState* state) {
typedef compiler::Node Node;
CodeStubAssembler assembler(state);
Node* receiver = assembler->Parameter(0);
Node* context = assembler->Parameter(3);
Node* receiver = assembler.Parameter(0);
Node* context = assembler.Parameter(3);
Node* result = assembler->ToThisValue(
Node* result = assembler.ToThisValue(
context, receiver, PrimitiveType::kSymbol, "Symbol.prototype.valueOf");
assembler->Return(result);
assembler.Return(result);
}
} // namespace internal
......
This diff is collapsed.
......@@ -4,7 +4,7 @@
#include "src/builtins/builtins.h"
#include "src/code-events.h"
#include "src/code-stub-assembler.h"
#include "src/compiler/code-assembler.h"
#include "src/ic/ic-state.h"
#include "src/interface-descriptors.h"
#include "src/isolate.h"
......@@ -42,7 +42,7 @@ void PostBuildProfileAndTracing(Isolate* isolate, Code* code,
}
typedef void (*MacroAssemblerGenerator)(MacroAssembler*);
typedef void (*CodeAssemblerGenerator)(CodeStubAssembler*);
typedef void (*CodeAssemblerGenerator)(compiler::CodeAssemblerState*);
Code* BuildWithMacroAssembler(Isolate* isolate,
MacroAssemblerGenerator generator,
......@@ -86,9 +86,10 @@ Code* BuildWithCodeStubAssemblerJS(Isolate* isolate,
Zone zone(isolate->allocator(), ZONE_NAME);
const int argc_with_recv =
(argc == SharedFunctionInfo::kDontAdaptArgumentsSentinel) ? 0 : argc + 1;
CodeStubAssembler assembler(isolate, &zone, argc_with_recv, flags, name);
generator(&assembler);
Handle<Code> code = assembler.GenerateCode();
compiler::CodeAssemblerState state(isolate, &zone, argc_with_recv, flags,
name);
generator(&state);
Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state);
PostBuildProfileAndTracing(isolate, *code, name);
return *code;
}
......@@ -105,9 +106,9 @@ Code* BuildWithCodeStubAssemblerCS(Isolate* isolate,
CallInterfaceDescriptor descriptor(isolate, interface_descriptor);
// Ensure descriptor is already initialized.
DCHECK_LE(0, descriptor.GetRegisterParameterCount());
CodeStubAssembler assembler(isolate, &zone, descriptor, flags, name);
generator(&assembler);
Handle<Code> code = assembler.GenerateCode();
compiler::CodeAssemblerState state(isolate, &zone, descriptor, flags, name);
generator(&state);
Handle<Code> code = compiler::CodeAssembler::GenerateCode(&state);
PostBuildProfileAndTracing(isolate, *code, name);
return *code;
}
......
......@@ -716,8 +716,10 @@ namespace internal {
IGNORE_BUILTIN, IGNORE_BUILTIN, V)
// Forward declarations.
class CodeStubAssembler;
class ObjectVisitor;
namespace compiler {
class CodeAssemblerState;
}
class Builtins {
public:
......@@ -816,16 +818,13 @@ class Builtins {
static void Generate_InterpreterPushArgsAndConstructImpl(
MacroAssembler* masm, CallableType function_type);
static void Generate_DatePrototype_GetField(CodeStubAssembler* masm,
int field_index);
enum class MathMaxMinKind { kMax, kMin };
static void Generate_MathMaxMin(MacroAssembler* masm, MathMaxMinKind kind);
#define DECLARE_ASM(Name, ...) \
static void Generate_##Name(MacroAssembler* masm);
#define DECLARE_TF(Name, ...) \
static void Generate_##Name(CodeStubAssembler* csasm);
static void Generate_##Name(compiler::CodeAssemblerState* state);
BUILTIN_LIST(IGNORE_BUILTIN, IGNORE_BUILTIN, DECLARE_TF, DECLARE_TF,
DECLARE_ASM, DECLARE_ASM, DECLARE_ASM)
......
......@@ -13,18 +13,6 @@ namespace internal {
using compiler::Node;
CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
const CallInterfaceDescriptor& descriptor,
Code::Flags flags, const char* name,
size_t result_size)
: compiler::CodeAssembler(isolate, zone, descriptor, flags, name,
result_size) {}
CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
int parameter_count, Code::Flags flags,
const char* name)
: compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {}
void CodeStubAssembler::Assert(ConditionBody codition_body, const char* message,
const char* file, int line) {
#if defined(DEBUG)
......
......@@ -44,17 +44,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
// from a compiler directory OWNER).
class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
public:
// Create with CallStub linkage.
// |result_size| specifies the number of results returned by the stub.
// TODO(rmcilroy): move result_size to the CallInterfaceDescriptor.
CodeStubAssembler(Isolate* isolate, Zone* zone,
const CallInterfaceDescriptor& descriptor,
Code::Flags flags, const char* name,
size_t result_size = 1);
// Create with JSCall linkage.
CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count,
Code::Flags flags, const char* name);
CodeStubAssembler(compiler::CodeAssemblerState* state)
: compiler::CodeAssembler(state) {}
enum AllocationFlag : uint8_t {
kNone = 0,
......
......@@ -251,8 +251,9 @@ Handle<Code> HydrogenCodeStub::GenerateRuntimeTailCall(
const char* name = CodeStub::MajorName(MajorKey());
Zone zone(isolate()->allocator(), ZONE_NAME);
CallInterfaceDescriptor interface_descriptor(GetCallInterfaceDescriptor());
CodeStubAssembler assembler(isolate(), &zone, interface_descriptor,
GetCodeFlags(), name);
compiler::CodeAssemblerState state(isolate(), &zone, interface_descriptor,
GetCodeFlags(), name);
CodeStubAssembler assembler(&state);
int total_params = interface_descriptor.GetStackParameterCount() +
interface_descriptor.GetRegisterParameterCount();
switch (total_params) {
......@@ -284,7 +285,7 @@ Handle<Code> HydrogenCodeStub::GenerateRuntimeTailCall(
UNIMPLEMENTED();
break;
}
return assembler.GenerateCode();
return compiler::CodeAssembler::GenerateCode(&state);
}
template <class Stub>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -10,7 +10,6 @@
#include "src/handles-inl.h"
#include "src/objects.h" // For FAA::LoadInternalField impl.
using v8::internal::CodeStubAssembler;
using v8::internal::compiler::Node;
namespace v8 {
......@@ -19,9 +18,9 @@ namespace internal {
FastAccessorAssembler::FastAccessorAssembler(Isolate* isolate)
: zone_(isolate->allocator(), ZONE_NAME),
isolate_(isolate),
assembler_(new CodeStubAssembler(isolate, zone(), 1,
Code::ComputeFlags(Code::STUB),
"FastAccessorAssembler")),
assembler_state_(isolate, zone(), 1, Code::ComputeFlags(Code::STUB),
"FastAccessorAssembler"),
assembler_(new CodeStubAssembler(&assembler_state_)),
state_(kBuilding) {}
FastAccessorAssembler::~FastAccessorAssembler() { Clear(); }
......@@ -248,7 +247,7 @@ void FastAccessorAssembler::CheckIsJSObjectOrJump(ValueId value_id,
MaybeHandle<Code> FastAccessorAssembler::Build() {
CHECK_EQ(kBuilding, state_);
Handle<Code> code = assembler_->GenerateCode();
Handle<Code> code = compiler::CodeAssembler::GenerateCode(&assembler_state_);
state_ = !code.is_null() ? kBuilt : kError;
Clear();
return code;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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