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

Unified Diff: src/ic/x64/handler-compiler-x64.cc

Issue 778673002: Do not embed function in DirectLoadGlobalFunctionPrototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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
Index: src/ic/x64/handler-compiler-x64.cc
diff --git a/src/ic/x64/handler-compiler-x64.cc b/src/ic/x64/handler-compiler-x64.cc
index ae1454b48fa6cfed31b1fe4b24e66df57899b409..dd6349ddd7dec6d662de6b2f4670bcfd1621bdaf 100644
--- a/src/ic/x64/handler-compiler-x64.cc
+++ b/src/ic/x64/handler-compiler-x64.cc
@@ -56,24 +56,26 @@ void PropertyHandlerCompiler::GenerateDictionaryNegativeLookup(
void NamedLoadHandlerCompiler::GenerateDirectLoadGlobalFunctionPrototype(
- MacroAssembler* masm, int index, Register prototype, Label* miss) {
+ MacroAssembler* masm, int index, Register prototype, Register scratch,
+ Label* miss) {
Isolate* isolate = masm->isolate();
// Get the global function with the given index.
- Handle<JSFunction> function(
+ Handle<JSFunction> jsfunction(
JSFunction::cast(isolate->native_context()->get(index)));
-
+ Handle<WeakCell> cell = isolate->factory()->NewWeakCell(jsfunction);
// Check we're still in the same context.
- Register scratch = prototype;
+ Register function = prototype;
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);
+ __ movp(function, Operand(scratch, Context::SlotOffset(index)));
+ __ CmpWeakValue(function, cell, scratch);
__ j(not_equal, miss);
-
// Load its initial map. The global functions all have initial maps.
- __ Move(prototype, Handle<Map>(function->initial_map()));
+ __ movp(scratch,
+ FieldOperand(function, JSFunction::kPrototypeOrInitialMapOffset));
// Load the prototype from the initial map.
- __ movp(prototype, FieldOperand(prototype, Map::kPrototypeOffset));
+ __ movp(prototype, FieldOperand(scratch, Map::kPrototypeOffset));
}
« src/ic/arm64/handler-compiler-arm64.cc ('K') | « src/ic/ia32/handler-compiler-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698