Commit b98a3711 authored by ulan's avatar ulan Committed by Commit bot

Do not embed function in DirectLoadGlobalFunctionPrototype.

BUG=v8:3629
LOG=N

Review URL: https://codereview.chromium.org/778673002

Cr-Commit-Position: refs/heads/master@{#25657}
parent 2bf048f4
......@@ -140,26 +140,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
MacroAssembler* masm, int index, Register result, Label* miss) {
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ ldr(scratch, MemOperand(cp, offset));
__ ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
__ ldr(scratch, MemOperand(scratch, Context::SlotOffset(index)));
__ Move(ip, function);
__ cmp(ip, scratch);
__ b(ne, miss);
__ ldr(result, MemOperand(cp, offset));
__ ldr(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset));
__ ldr(result, MemOperand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Handle<Map>(function->initial_map()));
__ ldr(result,
FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
__ ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
}
......
......@@ -57,24 +57,15 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
__ Ldr(scratch, GlobalObjectMemOperand());
__ Ldr(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
__ Ldr(scratch, ContextMemOperand(scratch, index));
__ Cmp(scratch, Operand(function));
__ B(ne, miss);
MacroAssembler* masm, int index, Register result, Label* miss) {
__ Ldr(result, GlobalObjectMemOperand());
__ Ldr(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset));
__ Ldr(result, ContextMemOperand(result, index));
// Load its initial map. The global functions all have initial maps.
__ Mov(prototype, Operand(Handle<Map>(function->initial_map())));
__ Ldr(result,
FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ Ldr(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
__ Ldr(result, FieldMemOperand(result, Map::kPrototypeOffset));
}
......
......@@ -88,22 +88,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(masm->isolate()->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
MacroAssembler* masm, int index, Register result, Label* miss) {
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ mov(scratch, Operand(esi, offset));
__ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
__ cmp(Operand(scratch, Context::SlotOffset(index)), function);
__ j(not_equal, miss);
__ mov(result, Operand(esi, offset));
__ mov(result, FieldOperand(result, GlobalObject::kNativeContextOffset));
__ mov(result, Operand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Immediate(Handle<Map>(function->initial_map())));
__ mov(result,
FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
__ mov(result, FieldOperand(result, Map::kPrototypeOffset));
}
......
......@@ -138,25 +138,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
MacroAssembler* masm, int index, Register result, Label* miss) {
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ lw(scratch, MemOperand(cp, offset));
__ lw(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
__ lw(scratch, MemOperand(scratch, Context::SlotOffset(index)));
__ li(at, function);
__ Branch(miss, ne, at, Operand(scratch));
__ lw(result, MemOperand(cp, offset));
__ lw(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset));
__ lw(result, MemOperand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ li(prototype, Handle<Map>(function->initial_map()));
__ lw(result,
FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ lw(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
__ lw(result, FieldMemOperand(result, Map::kPrototypeOffset));
}
......
......@@ -138,25 +138,17 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->native_context()->get(index)));
MacroAssembler* masm, int index, Register result, Label* miss) {
// Check we're still in the same context.
Register scratch = prototype;
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ ld(scratch, MemOperand(cp, offset));
__ ld(scratch, FieldMemOperand(scratch, GlobalObject::kNativeContextOffset));
__ ld(scratch, MemOperand(scratch, Context::SlotOffset(index)));
__ li(at, function);
__ Branch(miss, ne, at, Operand(scratch));
__ ld(result, MemOperand(cp, offset));
__ ld(result, FieldMemOperand(result, GlobalObject::kNativeContextOffset));
__ ld(result, MemOperand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ li(prototype, Handle<Map>(function->initial_map()));
__ ld(result,
FieldMemOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ ld(prototype, FieldMemOperand(prototype, Map::kPrototypeOffset));
__ ld(result, FieldMemOperand(result, Map::kPrototypeOffset));
}
......
......@@ -56,24 +56,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(isolate->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
MacroAssembler* masm, int index, Register result, Label* miss) {
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ movp(scratch, Operand(rsi, offset));
__ movp(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
__ Cmp(Operand(scratch, Context::SlotOffset(index)), function);
__ j(not_equal, miss);
__ movp(result, Operand(rsi, offset));
__ movp(result, FieldOperand(result, GlobalObject::kNativeContextOffset));
__ movp(result, Operand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Handle<Map>(function->initial_map()));
__ movp(result,
FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
__ movp(result, FieldOperand(result, Map::kPrototypeOffset));
}
......
......@@ -88,22 +88,16 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
MacroAssembler* masm, int index, Register prototype, Label* miss) {
// Get the global function with the given index.
Handle<JSFunction> function(
JSFunction::cast(masm->isolate()->native_context()->get(index)));
// Check we're still in the same context.
Register scratch = prototype;
MacroAssembler* masm, int index, Register result, Label* miss) {
const int offset = Context::SlotOffset(Context::GLOBAL_OBJECT_INDEX);
__ mov(scratch, Operand(esi, offset));
__ mov(scratch, FieldOperand(scratch, GlobalObject::kNativeContextOffset));
__ cmp(Operand(scratch, Context::SlotOffset(index)), function);
__ j(not_equal, miss);
__ mov(result, Operand(esi, offset));
__ mov(result, FieldOperand(result, GlobalObject::kNativeContextOffset));
__ mov(result, Operand(result, Context::SlotOffset(index)));
// Load its initial map. The global functions all have initial maps.
__ Move(prototype, Immediate(Handle<Map>(function->initial_map())));
__ mov(result,
FieldOperand(result, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
__ mov(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
__ mov(result, FieldOperand(result, Map::kPrototypeOffset));
}
......
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