Merged r15395, r15396, r15397 into trunk branch.
MIPS: Hydrogen array constructor cleanup and improvements.
MIPS: Improved function entry hook coverage.
MIPS: Fix wrong checkin.
R=jkummerow@chromium.org
BUG=
Review URL: https://codereview.chromium.org/18177014
git-svn-id: http://v8.googlecode.com/svn/trunk@15399 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc
index e9188ef..dddf045 100644
--- a/src/mips/builtins-mips.cc
+++ b/src/mips/builtins-mips.cc
@@ -740,6 +740,7 @@
// -- a3: argc
// -- s0: argv
// -----------------------------------
+ ProfileEntryHookStub::MaybeCallEntryHook(masm);
// Clear the context before we push it when entering the JS frame.
__ mov(cp, zero_reg);
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc
index 2da8fc0..3e42309 100644
--- a/src/mips/code-stubs-mips.cc
+++ b/src/mips/code-stubs-mips.cc
@@ -3530,6 +3530,8 @@
// sp: stack pointer (restored as callee's sp after C call)
// cp: current context (C callee-saved)
+ ProfileEntryHookStub::MaybeCallEntryHook(masm);
+
// NOTE: Invocations of builtins may return failure objects
// instead of a proper result. The builtin entry handles
// this by performing a garbage collection and retrying the
@@ -3623,6 +3625,8 @@
// 4 args slots
// args
+ ProfileEntryHookStub::MaybeCallEntryHook(masm);
+
// Save callee saved registers on the stack.
__ MultiPush(kCalleeSaved | ra.bit());
@@ -5045,11 +5049,15 @@
// Special handling of the Array() function, which caches not only the
// monomorphic Array function but the initial ElementsKind with special
// sentinels
- Handle<Object> terminal_kind_sentinel =
- TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
- LAST_FAST_ELEMENTS_KIND);
__ JumpIfNotSmi(a3, &miss);
- __ Branch(&miss, gt, a3, Operand(terminal_kind_sentinel));
+ if (FLAG_debug_code) {
+ Handle<Object> terminal_kind_sentinel =
+ TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(),
+ LAST_FAST_ELEMENTS_KIND);
+ __ Assert(le, "Array function sentinel is not an ElementsKind",
+ a3, Operand(terminal_kind_sentinel));
+ }
+
// Make sure the function is the Array() function
__ LoadArrayFunction(a3);
__ Branch(&megamorphic, ne, a1, Operand(a3));
@@ -7506,7 +7514,8 @@
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
- if (entry_hook_ != NULL) {
+ if (masm->isolate()->function_entry_hook() != NULL) {
+ AllowStubCallsScope allow_stub_calls(masm, true);
ProfileEntryHookStub stub;
__ push(ra);
__ CallStub(&stub);
@@ -7522,8 +7531,11 @@
Assembler::kCallTargetAddressOffset + (2 * Assembler::kInstrSize);
// Save live volatile registers.
- __ Push(ra, t1, a1);
- const int32_t kNumSavedRegs = 3;
+ // We also save ra, so the count here is one higher than the mask indicates.
+ const int32_t kNumSavedRegs = kNumJSCallerSaved + 1;
+
+ // Save all caller-save registers as this may be called from anywhere.
+ __ MultiPush(kJSCallerSaved | ra.bit());
// Compute the function's address for the first argument.
__ Subu(a0, ra, Operand(kReturnAddressDistanceFromFunctionStart));
@@ -7541,14 +7553,13 @@
}
#if defined(V8_HOST_ARCH_MIPS)
- __ li(at, Operand(reinterpret_cast<int32_t>(&entry_hook_)));
- __ lw(at, MemOperand(at));
+ int32_t entry_hook =
+ reinterpret_cast<int32_t>(masm->isolate()->function_entry_hook());
+ __ li(at, Operand(entry_hook));
#else
// Under the simulator we need to indirect the entry hook through a
// trampoline function at a known address.
- Address trampoline_address = reinterpret_cast<Address>(
- reinterpret_cast<intptr_t>(EntryHookTrampoline));
- ApiFunction dispatcher(trampoline_address);
+ ApiFunction dispatcher(FUNCTION_ADDR(EntryHookTrampoline));
__ li(at, Operand(ExternalReference(&dispatcher,
ExternalReference::BUILTIN_CALL,
masm->isolate())));
@@ -7560,7 +7571,8 @@
__ mov(sp, t1);
}
- __ Pop(ra, t1, a1);
+ // Also pop ra to get Ret(0).
+ __ MultiPop(kJSCallerSaved | ra.bit());
__ Ret();
}
@@ -7614,6 +7626,10 @@
__ Addu(a3, a3, Operand(1));
__ Branch(&normal_sequence, eq, a2, Operand(undefined_sentinel));
+ // The type cell may have gone megamorphic, don't overwrite if so.
+ __ lw(t1, FieldMemOperand(a2, kPointerSize));
+ __ JumpIfNotSmi(t1, &normal_sequence);
+
// Save the resulting elements kind in type info
__ SmiTag(a3);
__ sw(a3, FieldMemOperand(a2, kPointerSize));
@@ -7645,7 +7661,7 @@
T stub(kind);
stub.GetCode(isolate)->set_is_pregenerated(true);
if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) {
- T stub1(kind, true);
+ T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES);
stub1.GetCode(isolate)->set_is_pregenerated(true);
}
}
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc
index 6751be7..3e55923 100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -4049,11 +4049,14 @@
__ li(a0, Operand(instr->arity()));
__ li(a2, Operand(instr->hydrogen()->property_cell()));
ElementsKind kind = instr->hydrogen()->elements_kind();
- bool disable_allocation_sites =
- (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE);
+ AllocationSiteOverrideMode override_mode =
+ (AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE)
+ ? DISABLE_ALLOCATION_SITES
+ : DONT_OVERRIDE;
+ ContextCheckMode context_mode = CONTEXT_CHECK_NOT_REQUIRED;
if (instr->arity() == 0) {
- ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites);
+ ArrayNoArgumentConstructorStub stub(kind, context_mode, override_mode);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
} else if (instr->arity() == 1) {
Label done;
@@ -4065,18 +4068,18 @@
__ Branch(&packed_case, eq, t1, Operand(zero_reg));
ElementsKind holey_kind = GetHoleyElementsKind(kind);
- ArraySingleArgumentConstructorStub stub(holey_kind,
- disable_allocation_sites);
+ ArraySingleArgumentConstructorStub stub(holey_kind, context_mode,
+ override_mode);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
__ jmp(&done);
__ bind(&packed_case);
}
- ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites);
+ ArraySingleArgumentConstructorStub stub(kind, context_mode, override_mode);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
__ bind(&done);
} else {
- ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites);
+ ArrayNArgumentsConstructorStub stub(kind, context_mode, override_mode);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
}
}
diff --git a/src/mips/lithium-mips.cc b/src/mips/lithium-mips.cc
index ba7fbd3..e68c722 100644
--- a/src/mips/lithium-mips.cc
+++ b/src/mips/lithium-mips.cc
@@ -330,8 +330,7 @@
constructor()->PrintTo(stream);
stream->Add(" #%d / ", arity());
ASSERT(hydrogen()->property_cell()->value()->IsSmi());
- ElementsKind kind = static_cast<ElementsKind>(
- Smi::cast(hydrogen()->property_cell()->value())->value());
+ ElementsKind kind = hydrogen()->elements_kind();
stream->Add(" (%s) ", ElementsKindToString(kind));
}
diff --git a/src/version.cc b/src/version.cc
index 03d77bf..84cafc8 100644
--- a/src/version.cc
+++ b/src/version.cc
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 20
#define BUILD_NUMBER 0
-#define PATCH_LEVEL 0
+#define PATCH_LEVEL 1
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0