Revision: 7500
Author: [email protected]
Date: Tue Apr 5 02:21:02 2011
Log: Add inline non-transcendental cache version of log to lithium.
In addition, this change allows one additional level of inlining.
Review URL: http://codereview.chromium.org/6720017
http://code.google.com/p/v8/source/detail?r=7500
Modified:
/branches/bleeding_edge/src/compiler.h
/branches/bleeding_edge/src/hydrogen.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-ia32.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/top.cc
=======================================
--- /branches/bleeding_edge/src/compiler.h Fri Mar 18 13:35:07 2011
+++ /branches/bleeding_edge/src/compiler.h Tue Apr 5 02:21:02 2011
@@ -239,6 +239,8 @@
// give up.
static const int kDefaultMaxOptCount = 10;
+ static const int kMaxInliningLevels = 3;
+
// All routines return a SharedFunctionInfo.
// If an error occurs an exception is raised and the return handle
// contains NULL.
=======================================
--- /branches/bleeding_edge/src/hydrogen.cc Mon Apr 4 08:03:34 2011
+++ /branches/bleeding_edge/src/hydrogen.cc Tue Apr 5 02:21:02 2011
@@ -3931,11 +3931,16 @@
return false;
}
- // Don't inline deeper than two calls.
+ // Don't inline deeper than kMaxInliningLevels calls.
HEnvironment* env = environment();
- if (env->outer() != NULL && env->outer()->outer() != NULL) {
- TraceInline(target, "inline depth limit reached");
- return false;
+ int current_level = 1;
+ while (env->outer() != NULL) {
+ if (current_level == Compiler::kMaxInliningLevels) {
+ TraceInline(target, "inline depth limit reached");
+ return false;
+ }
+ current_level++;
+ env = env->outer();
}
// Don't inline recursive functions.
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Apr 4
08:03:34 2011
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Apr 5
02:21:02 2011
@@ -2787,10 +2787,32 @@
void LCodeGen::DoMathLog(LUnaryMathOperation* instr) {
- ASSERT(ToDoubleRegister(instr->result()).is(xmm1));
- TranscendentalCacheStub stub(TranscendentalCache::LOG,
- TranscendentalCacheStub::UNTAGGED);
- CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false);
+ ASSERT(instr->InputAt(0)->Equals(instr->result()));
+ XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0));
+ NearLabel positive, done, zero, negative;
+ __ xorpd(xmm0, xmm0);
+ __ ucomisd(input_reg, xmm0);
+ __ j(above, &positive);
+ __ j(equal, &zero);
+ ExternalReference nan = ExternalReference::address_of_nan();
+ __ movdbl(input_reg, Operand::StaticVariable(nan));
+ __ jmp(&done);
+ __ bind(&zero);
+ __ push(Immediate(0xFFF00000));
+ __ push(Immediate(0));
+ __ movdbl(input_reg, Operand(esp, 0));
+ __ add(Operand(esp), Immediate(kDoubleSize));
+ __ jmp(&done);
+ __ bind(&positive);
+ __ fldln2();
+ __ sub(Operand(esp), Immediate(kDoubleSize));
+ __ movdbl(Operand(esp, 0), input_reg);
+ __ fld_d(Operand(esp, 0));
+ __ fyl2x();
+ __ fstp_d(Operand(esp, 0));
+ __ movdbl(input_reg, Operand(esp, 0));
+ __ add(Operand(esp), Immediate(kDoubleSize));
+ __ bind(&done);
}
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-ia32.cc Mon Apr 4 08:03:34
2011
+++ /branches/bleeding_edge/src/ia32/lithium-ia32.cc Tue Apr 5 02:21:02
2011
@@ -1224,7 +1224,13 @@
LInstruction* LChunkBuilder::DoUnaryMathOperation(HUnaryMathOperation*
instr) {
BuiltinFunctionId op = instr->op();
- if (op == kMathLog || op == kMathSin || op == kMathCos) {
+ if (op == kMathLog) {
+ ASSERT(instr->representation().IsDouble());
+ ASSERT(instr->value()->representation().IsDouble());
+ LOperand* input = UseRegisterAtStart(instr->value());
+ LUnaryMathOperation* result = new LUnaryMathOperation(input);
+ return DefineSameAsFirst(result);
+ } else if (op == kMathSin || op == kMathCos) {
LOperand* input = UseFixedDouble(instr->value(), xmm1);
LUnaryMathOperation* result = new LUnaryMathOperation(input);
return MarkAsCall(DefineFixedDouble(result, xmm1), instr);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Tue Apr 5 02:01:47 2011
+++ /branches/bleeding_edge/src/runtime.cc Tue Apr 5 02:21:02 2011
@@ -11615,7 +11615,9 @@
if (ShowFrameInStackTrace(raw_frame, *caller, &seen_caller)) {
frames_seen++;
JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame);
- List<FrameSummary> frames(3); // Max 2 levels of inlining.
+ // Set initial size to the maximum inlining level + 1 for the
outermost
+ // function.
+ List<FrameSummary> frames(Compiler::kMaxInliningLevels + 1);
frame->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0; i--) {
if (cursor + 4 > elements->length()) {
=======================================
--- /branches/bleeding_edge/src/top.cc Tue Apr 5 02:01:47 2011
+++ /branches/bleeding_edge/src/top.cc Tue Apr 5 02:21:02 2011
@@ -29,6 +29,7 @@
#include "api.h"
#include "bootstrapper.h"
+#include "compiler.h"
#include "debug.h"
#include "execution.h"
#include "messages.h"
@@ -37,6 +38,7 @@
#include "string-stream.h"
#include "vm-state-inl.h"
+
// TODO(isolates): move to isolate.cc. This stuff is kept here to
// simplify merging.
@@ -208,8 +210,9 @@
int frames_seen = 0;
while (!it.done() && (frames_seen < limit)) {
JavaScriptFrame* frame = it.frame();
-
- List<FrameSummary> frames(3); // Max 2 levels of inlining.
+ // Set initial size to the maximum inlining level + 1 for the outermost
+ // function.
+ List<FrameSummary> frames(Compiler::kMaxInliningLevels + 1);
frame->Summarize(&frames);
for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) {
// Create a JSObject to hold the information for the StackFrame.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev