Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: src/x64/stub-cache-x64.cc

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | src/zone.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/stub-cache-x64.cc
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc
index 06d8f7108b0505abe6db83c750d38cf228457156..f42b1b86311f0a181c2381ae4091e6dc4f7a583f 100644
--- a/src/x64/stub-cache-x64.cc
+++ b/src/x64/stub-cache-x64.cc
@@ -491,11 +491,14 @@ static void GenerateFastApiCall(MacroAssembler* masm,
#if defined(__MINGW64__)
Register arguments_arg = rcx;
+ Register callback_arg = rdx;
#elif defined(_WIN64)
// Win64 uses first register--rcx--for returned value.
Register arguments_arg = returns_handle ? rdx : rcx;
+ Register callback_arg = returns_handle ? r8 : rdx;
#else
Register arguments_arg = rdi;
+ Register callback_arg = rsi;
#endif
// Allocate the v8::Arguments structure in the arguments' space since
@@ -514,7 +517,13 @@ static void GenerateFastApiCall(MacroAssembler* masm,
// v8::InvocationCallback's argument.
__ lea(arguments_arg, StackSpaceOperand(0));
+ Address thunk_address = returns_handle
+ ? FUNCTION_ADDR(&InvokeInvocationCallback)
+ : FUNCTION_ADDR(&InvokeFunctionCallback);
+
__ CallApiFunctionAndReturn(function_address,
+ thunk_address,
+ callback_arg,
argc + kFastApiCallArguments + 1,
returns_handle,
kFastApiCallArguments + 1);
@@ -737,11 +746,11 @@ static void GenerateCheckPropertyCell(MacroAssembler* masm,
Handle<Name> name,
Register scratch,
Label* miss) {
- Handle<JSGlobalPropertyCell> cell =
+ Handle<PropertyCell> cell =
GlobalObject::EnsurePropertyCell(global, name);
ASSERT(cell->value()->IsTheHole());
__ Move(scratch, cell);
- __ Cmp(FieldOperand(scratch, JSGlobalPropertyCell::kValueOffset),
+ __ Cmp(FieldOperand(scratch, Cell::kValueOffset),
masm->isolate()->factory()->the_hole_value());
__ j(not_equal, miss);
}
@@ -817,7 +826,13 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
Register storage_reg = name_reg;
- if (FLAG_track_fields && representation.IsSmi()) {
+ if (details.type() == CONSTANT_FUNCTION) {
+ Handle<HeapObject> constant(
+ HeapObject::cast(descriptors->GetValue(descriptor)));
+ __ LoadHeapObject(scratch1, constant);
+ __ cmpq(value_reg, scratch1);
+ __ j(not_equal, miss_restore_name);
+ } else if (FLAG_track_fields && representation.IsSmi()) {
__ JumpIfNotSmi(value_reg, miss_restore_name);
} else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
__ JumpIfSmi(value_reg, miss_restore_name);
@@ -844,7 +859,8 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
// Perform map transition for the receiver if necessary.
- if (object->map()->unused_property_fields() == 0) {
+ if (details.type() == FIELD &&
+ object->map()->unused_property_fields() == 0) {
// The properties must be extended before we can store the value.
// We jump to a runtime call that extends the properties array.
__ pop(scratch1); // Return address.
@@ -873,6 +889,12 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm,
OMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
+ if (details.type() == CONSTANT_FUNCTION) {
+ ASSERT(value_reg.is(rax));
+ __ ret(0);
+ return;
+ }
+
int index = transition->instance_descriptors()->GetFieldIndex(
transition->LastAdded());
@@ -1318,13 +1340,16 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
!CallbackTable::ReturnsVoid(isolate(), getter_address);
#if defined(__MINGW64__)
+ Register getter_arg = r8;
Register accessor_info_arg = rdx;
Register name_arg = rcx;
#elif defined(_WIN64)
// Win64 uses first register--rcx--for returned value.
+ Register getter_arg = returns_handle ? r9 : r8;
Register accessor_info_arg = returns_handle ? r8 : rdx;
Register name_arg = returns_handle ? rdx : rcx;
#else
+ Register getter_arg = rdx;
Register accessor_info_arg = rsi;
Register name_arg = rdi;
#endif
@@ -1350,7 +1375,13 @@ void BaseLoadStubCompiler::GenerateLoadCallback(
// could be used to pass arguments.
__ lea(accessor_info_arg, StackSpaceOperand(0));
+ Address thunk_address = returns_handle
+ ? FUNCTION_ADDR(&InvokeAccessorGetter)
+ : FUNCTION_ADDR(&InvokeAccessorGetterCallback);
+
__ CallApiFunctionAndReturn(getter_address,
+ thunk_address,
+ getter_arg,
kStackSpace,
returns_handle,
5);
@@ -1485,12 +1516,12 @@ void CallStubCompiler::GenerateGlobalReceiverCheck(Handle<JSObject> object,
void CallStubCompiler::GenerateLoadFunctionFromCell(
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
Label* miss) {
// Get the value from the cell.
__ Move(rdi, cell);
- __ movq(rdi, FieldOperand(rdi, JSGlobalPropertyCell::kValueOffset));
+ __ movq(rdi, FieldOperand(rdi, Cell::kValueOffset));
// Check that the cell contains the same function.
if (heap()->InNewSpace(*function)) {
@@ -1581,12 +1612,59 @@ Handle<Code> CallStubCompiler::CompileCallField(Handle<JSObject> object,
}
+Handle<Code> CallStubCompiler::CompileArrayCodeCall(
+ Handle<Object> object,
+ Handle<JSObject> holder,
+ Handle<Cell> cell,
+ Handle<JSFunction> function,
+ Handle<String> name,
+ Code::StubType type) {
+ Label miss;
+
+ // Check that function is still array
+ const int argc = arguments().immediate();
+ GenerateNameCheck(name, &miss);
+
+ if (cell.is_null()) {
+ // Get the receiver from the stack.
+ __ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize));
+
+ // Check that the receiver isn't a smi.
+ __ JumpIfSmi(rdx, &miss);
+ CheckPrototypes(Handle<JSObject>::cast(object), rdx, holder, rbx, rax, rdi,
+ name, &miss);
+ } else {
+ ASSERT(cell->value() == *function);
+ GenerateGlobalReceiverCheck(Handle<JSObject>::cast(object), holder, name,
+ &miss);
+ GenerateLoadFunctionFromCell(cell, function, &miss);
+ }
+
+ Handle<Smi> kind(Smi::FromInt(GetInitialFastElementsKind()), isolate());
+ Handle<Cell> kind_feedback_cell =
+ isolate()->factory()->NewCell(kind);
+ __ movq(rax, Immediate(argc));
+ __ Move(rbx, kind_feedback_cell);
+ __ Move(rdi, function);
+
+ ArrayConstructorStub stub(isolate());
+ __ TailCallStub(&stub);
+
+ __ bind(&miss);
+ GenerateMissBranch();
+
+ // Return the generated code.
+ return GetCode(type, name);
+}
+
+
Handle<Code> CallStubCompiler::CompileArrayPushCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : name
// -- rsp[0] : return address
@@ -1827,16 +1905,17 @@ Handle<Code> CallStubCompiler::CompileArrayPushCall(
GenerateMissBranch();
// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}
Handle<Code> CallStubCompiler::CompileArrayPopCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : name
// -- rsp[0] : return address
@@ -1908,16 +1987,17 @@ Handle<Code> CallStubCompiler::CompileArrayPopCall(
GenerateMissBranch();
// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}
Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : function name
// -- rsp[0] : return address
@@ -1988,16 +2068,17 @@ Handle<Code> CallStubCompiler::CompileStringCharCodeAtCall(
GenerateMissBranch();
// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}
Handle<Code> CallStubCompiler::CompileStringCharAtCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : function name
// -- rsp[0] : return address
@@ -2068,16 +2149,17 @@ Handle<Code> CallStubCompiler::CompileStringCharAtCall(
GenerateMissBranch();
// Return the generated code.
- return GetCode(function);
+ return GetCode(type, name);
}
Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : function name
// -- rsp[0] : return address
@@ -2139,16 +2221,17 @@ Handle<Code> CallStubCompiler::CompileStringFromCharCodeCall(
GenerateMissBranch();
// Return the generated code.
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
+ return GetCode(type, name);
}
Handle<Code> CallStubCompiler::CompileMathFloorCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// TODO(872): implement this.
return Handle<Code>::null();
}
@@ -2157,9 +2240,10 @@ Handle<Code> CallStubCompiler::CompileMathFloorCall(
Handle<Code> CallStubCompiler::CompileMathAbsCall(
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
- Handle<String> name) {
+ Handle<String> name,
+ Code::StubType type) {
// ----------- S t a t e -------------
// -- rcx : function name
// -- rsp[0] : return address
@@ -2255,7 +2339,7 @@ Handle<Code> CallStubCompiler::CompileMathAbsCall(
GenerateMissBranch();
// Return the generated code.
- return cell.is_null() ? GetCode(function) : GetCode(Code::NORMAL, name);
+ return GetCode(type, name);
}
@@ -2263,7 +2347,7 @@ Handle<Code> CallStubCompiler::CompileFastApiCall(
const CallOptimization& optimization,
Handle<Object> object,
Handle<JSObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<Cell> cell,
Handle<JSFunction> function,
Handle<String> name) {
ASSERT(optimization.is_simple_api_call());
@@ -2445,8 +2529,9 @@ Handle<Code> CallStubCompiler::CompileCallConstant(
Handle<JSFunction> function) {
if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(object, holder,
- Handle<JSGlobalPropertyCell>::null(),
- function, Handle<String>::cast(name));
+ Handle<PropertyCell>::null(),
+ function, Handle<String>::cast(name),
+ Code::CONSTANT_FUNCTION);
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}
@@ -2525,7 +2610,7 @@ Handle<Code> CallStubCompiler::CompileCallInterceptor(Handle<JSObject> object,
Handle<Code> CallStubCompiler::CompileCallGlobal(
Handle<JSObject> object,
Handle<GlobalObject> holder,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<PropertyCell> cell,
Handle<JSFunction> function,
Handle<Name> name) {
// ----------- S t a t e -------------
@@ -2540,7 +2625,8 @@ Handle<Code> CallStubCompiler::CompileCallGlobal(
if (HasCustomCallGenerator(function)) {
Handle<Code> code = CompileCustomCall(
- object, holder, cell, function, Handle<String>::cast(name));
+ object, holder, cell, function, Handle<String>::cast(name),
+ Code::NORMAL);
// A null handle means bail out to the regular compiler code below.
if (!code.is_null()) return code;
}
@@ -2708,7 +2794,7 @@ Handle<Code> StoreStubCompiler::CompileStoreInterceptor(
Handle<Code> StoreStubCompiler::CompileStoreGlobal(
Handle<GlobalObject> object,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<PropertyCell> cell,
Handle<Name> name) {
Label miss;
@@ -2720,7 +2806,7 @@ Handle<Code> StoreStubCompiler::CompileStoreGlobal(
// Compute the cell operand to use.
__ Move(scratch1(), cell);
Operand cell_operand =
- FieldOperand(scratch1(), JSGlobalPropertyCell::kValueOffset);
+ FieldOperand(scratch1(), PropertyCell::kValueOffset);
// Check that the value in the cell is not the hole. If it is, this
// cell could have been deleted and reintroducing the global needs
@@ -2888,7 +2974,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
Handle<Code> LoadStubCompiler::CompileLoadGlobal(
Handle<JSObject> object,
Handle<GlobalObject> global,
- Handle<JSGlobalPropertyCell> cell,
+ Handle<PropertyCell> cell,
Handle<Name> name,
bool is_dont_delete) {
Label success, miss;
@@ -2902,7 +2988,7 @@ Handle<Code> LoadStubCompiler::CompileLoadGlobal(
// Get the value from the cell.
__ Move(rbx, cell);
- __ movq(rbx, FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset));
+ __ movq(rbx, FieldOperand(rbx, PropertyCell::kValueOffset));
// Check for deleted property if property can actually be deleted.
if (!is_dont_delete) {
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | src/zone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698