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

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

Issue 149403003: A64: Synchronize with r19234. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 10 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/a64/macro-assembler-a64.cc ('k') | src/accessors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/a64/stub-cache-a64.cc
diff --git a/src/a64/stub-cache-a64.cc b/src/a64/stub-cache-a64.cc
index fa3fa37063106cc591aa369a5135d61782e186ee..19f9dd604330173f84e8af65794471f141d014fa 100644
--- a/src/a64/stub-cache-a64.cc
+++ b/src/a64/stub-cache-a64.cc
@@ -744,11 +744,24 @@ static void CompileCallLoadPropertyWithInterceptor(
}
-static void GenerateFastApiCallBody(MacroAssembler* masm,
- const CallOptimization& optimization,
- int argc,
- Register holder_in,
- bool restore_context) {
+// Generate call to api function.
+static void GenerateFastApiCall(MacroAssembler* masm,
+ const CallOptimization& optimization,
+ Handle<Map> receiver_map,
+ Register receiver,
+ Register scratch,
+ int argc,
+ Register* values) {
+ ASSERT(!AreAliased(receiver, scratch));
+ __ Push(receiver);
+ // Write the arguments to stack frame.
+ for (int i = 0; i < argc; i++) {
+ // TODO(jbramley): Push these in as few Push() calls as possible.
+ Register arg = values[argc-1-i];
+ ASSERT(!AreAliased(receiver, scratch, arg));
+ __ Push(arg);
+ }
+
ASSERT(optimization.is_simple_api_call());
// Abi for CallApiFunctionStub.
@@ -758,7 +771,20 @@ static void GenerateFastApiCallBody(MacroAssembler* masm,
Register api_function_address = x1;
// Put holder in place.
- __ Mov(holder, holder_in);
+ CallOptimization::HolderLookup holder_lookup;
+ Handle<JSObject> api_holder =
+ optimization.LookupHolderOfExpectedType(receiver_map, &holder_lookup);
+ switch (holder_lookup) {
+ case CallOptimization::kHolderIsReceiver:
+ __ Mov(holder, receiver);
+ break;
+ case CallOptimization::kHolderFound:
+ __ LoadObject(holder, api_holder);
+ break;
+ case CallOptimization::kHolderNotFound:
+ UNREACHABLE();
+ break;
+ }
Isolate* isolate = masm->isolate();
Handle<JSFunction> function = optimization.constant_function();
@@ -789,38 +815,11 @@ static void GenerateFastApiCallBody(MacroAssembler* masm,
__ Mov(api_function_address, Operand(ref));
// Jump to stub.
- CallApiFunctionStub stub(restore_context, call_data_undefined, argc);
+ CallApiFunctionStub stub(true, call_data_undefined, argc);
__ TailCallStub(&stub);
}
-// Generate call to api function.
-static void GenerateFastApiCall(MacroAssembler* masm,
- const CallOptimization& optimization,
- Register receiver,
- Register scratch,
- int argc,
- Register* values) {
- ASSERT(!AreAliased(receiver, scratch));
-
- __ Push(receiver);
- // Write the arguments to stack frame.
- for (int i = 0; i < argc; i++) {
- // TODO(all): Groups pushes to minimize Push overhead.
- Register arg = values[argc-1-i];
- ASSERT(!receiver.is(arg));
- ASSERT(!scratch.is(arg));
- __ Push(arg);
- }
- // Stack now matches JSFunction ABI.
- GenerateFastApiCallBody(masm,
- optimization,
- argc,
- receiver,
- true);
-}
-
-
void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
__ Jump(code, RelocInfo::CODE_TARGET);
}
@@ -1045,9 +1044,10 @@ void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
void LoadStubCompiler::GenerateLoadCallback(
- const CallOptimization& call_optimization) {
+ const CallOptimization& call_optimization,
+ Handle<Map> receiver_map) {
GenerateFastApiCall(
- masm(), call_optimization, receiver(), scratch3(), 0, NULL);
+ masm(), call_optimization, receiver_map, receiver(), scratch3(), 0, NULL);
}
@@ -1242,6 +1242,7 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
void StoreStubCompiler::GenerateStoreViaSetter(
MacroAssembler* masm,
+ Handle<HeapType> type,
Handle<JSFunction> setter) {
// ----------- S t a t e -------------
// -- x0 : value
@@ -1249,19 +1250,25 @@ void StoreStubCompiler::GenerateStoreViaSetter(
// -- x2 : name
// -- lr : return address
// -----------------------------------
- Register value_reg = x0;
- Register receiver_reg = x1;
+ Register value = x0;
+ Register receiver = x1;
Label miss;
{
FrameScope scope(masm, StackFrame::INTERNAL);
// Save value register, so we can restore it later.
- __ Push(value_reg);
+ __ Push(value);
if (!setter.is_null()) {
// Call the JavaScript setter with receiver and value on the stack.
- __ Push(receiver_reg, value_reg);
+ if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
+ // Swap in the global receiver.
+ __ Ldr(receiver,
+ FieldMemOperand(
+ receiver, JSGlobalObject::kGlobalReceiverOffset));
+ }
+ __ Push(receiver, value);
ParameterCount actual(1);
ParameterCount expected(setter);
__ InvokeFunction(setter, expected, actual,
@@ -1273,7 +1280,7 @@ void StoreStubCompiler::GenerateStoreViaSetter(
}
// We have to return the passed value, not the return value of the setter.
- __ Pop(value_reg);
+ __ Pop(value);
// Restore context register.
__ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
@@ -1374,6 +1381,7 @@ Register* KeyedStoreStubCompiler::registers() {
#define __ ACCESS_MASM(masm)
void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
+ Handle<HeapType> type,
Register receiver,
Handle<JSFunction> getter) {
{
@@ -1381,6 +1389,12 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
if (!getter.is_null()) {
// Call the JavaScript getter with the receiver on the stack.
+ if (IC::TypeToMap(*type, masm->isolate())->IsJSGlobalObjectMap()) {
+ // Swap in the global receiver.
+ __ Ldr(receiver,
+ FieldMemOperand(
+ receiver, JSGlobalObject::kGlobalReceiverOffset));
+ }
__ Push(receiver);
ParameterCount actual(0);
ParameterCount expected(getter);
@@ -1525,8 +1539,8 @@ Handle<Code> StoreStubCompiler::CompileStoreCallback(
receiver(), holder, name);
Register values[] = { value() };
- GenerateFastApiCall(
- masm(), call_optimization, receiver(), scratch3(), 1, values);
+ GenerateFastApiCall(masm(), call_optimization, handle(object->map()),
+ receiver(), scratch3(), 1, values);
// Return the generated code.
return GetCode(kind(), Code::FAST, name);
« no previous file with comments | « src/a64/macro-assembler-a64.cc ('k') | src/accessors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698