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

Unified Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2870703003: Revert of PPC/s390: Reland: [TypeFeedbackVector] Store optimized code in the vector (Closed)
Patch Set: Created 3 years, 7 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 | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/ppc/builtins-ppc.cc
diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc
index 06ffa676d1b846a9182f8ceaa53d7a70273cf4de..5dfaa49620ca00ef156f5205858cc83fda2df501 100644
--- a/src/builtins/ppc/builtins-ppc.cc
+++ b/src/builtins/ppc/builtins-ppc.cc
@@ -1342,8 +1342,10 @@
// First lookup code, maybe we don't need to compile!
Label gotta_call_runtime;
Label try_shared;
+ Label loop_top, loop_bottom;
Register closure = r4;
+ Register map = r9;
Register index = r5;
// Do we have a valid feedback vector?
@@ -1351,29 +1353,58 @@
__ LoadP(index, FieldMemOperand(index, Cell::kValueOffset));
__ JumpIfRoot(index, Heap::kUndefinedValueRootIndex, &gotta_call_runtime);
- // Is optimized code available in the feedback vector?
+ __ LoadP(map,
+ FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
+ __ LoadP(map,
+ FieldMemOperand(map, SharedFunctionInfo::kOptimizedCodeMapOffset));
+ __ LoadP(index, FieldMemOperand(map, FixedArray::kLengthOffset));
+ __ CmpSmiLiteral(index, Smi::FromInt(2), r0);
+ __ blt(&try_shared);
+
+ // r10 : native context
+ // r5 : length / index
+ // r9 : optimized code map
+ // r6 : new target
+ // r4 : closure
+ Register native_context = r10;
+ __ LoadP(native_context, NativeContextMemOperand());
+
+ __ bind(&loop_top);
+ Register temp = r11;
+ Register array_pointer = r8;
+
+ // Does the native context match?
+ __ SmiToPtrArrayOffset(array_pointer, index);
+ __ add(array_pointer, map, array_pointer);
+ __ LoadP(temp, FieldMemOperand(array_pointer,
+ SharedFunctionInfo::kOffsetToPreviousContext));
+ __ LoadP(temp, FieldMemOperand(temp, WeakCell::kValueOffset));
+ __ cmp(temp, native_context);
+ __ bne(&loop_bottom);
+
+ // Code available?
Register entry = r7;
- __ LoadP(entry, FieldMemOperand(index, FeedbackVector::kOptimizedCodeIndex *
- kPointerSize +
- FeedbackVector::kHeaderSize));
+ __ LoadP(entry,
+ FieldMemOperand(array_pointer,
+ SharedFunctionInfo::kOffsetToPreviousCachedCode));
__ LoadP(entry, FieldMemOperand(entry, WeakCell::kValueOffset));
__ JumpIfSmi(entry, &try_shared);
+ // Found code. Get it into the closure and return.
// Store code entry in the closure.
__ addi(entry, entry, Operand(Code::kHeaderSize - kHeapObjectTag));
__ StoreP(entry, FieldMemOperand(closure, JSFunction::kCodeEntryOffset), r0);
__ RecordWriteCodeEntryField(closure, entry, r8);
- // Load native context into r9.
- Register native_context = r9;
- __ LoadP(native_context, NativeContextMemOperand());
-
// Link the closure into the optimized function list.
+ // r7 : code entry
+ // r10: native context
+ // r4 : closure
__ LoadP(
r8, ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST));
__ StoreP(r8, FieldMemOperand(closure, JSFunction::kNextFunctionLinkOffset),
r0);
- __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, r8, r5,
+ __ RecordWriteField(closure, JSFunction::kNextFunctionLinkOffset, r8, temp,
kLRHasNotBeenSaved, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
OMIT_SMI_CHECK);
const int function_list_offset =
@@ -1383,11 +1414,19 @@
ContextMemOperand(native_context, Context::OPTIMIZED_FUNCTIONS_LIST), r0);
// Save closure before the write barrier.
__ mr(r8, closure);
- __ RecordWriteContextSlot(native_context, function_list_offset, r8, r5,
+ __ RecordWriteContextSlot(native_context, function_list_offset, r8, temp,
kLRHasNotBeenSaved, kDontSaveFPRegs);
__ JumpToJSEntry(entry);
- // We found no optimized code.
+ __ bind(&loop_bottom);
+ __ SubSmiLiteral(index, index, Smi::FromInt(SharedFunctionInfo::kEntryLength),
+ r0);
+ __ CmpSmiLiteral(index, Smi::FromInt(1), r0);
+ __ bgt(&loop_top);
+
+ // We found no code.
+ __ b(&gotta_call_runtime);
+
__ bind(&try_shared);
__ LoadP(entry,
FieldMemOperand(closure, JSFunction::kSharedFunctionInfoOffset));
« no previous file with comments | « no previous file | src/builtins/s390/builtins-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698