Commit 3dd575ec authored by ricow@chromium.org's avatar ricow@chromium.org

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7500 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent c9904976
......@@ -239,6 +239,8 @@ class Compiler : public AllStatic {
// 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.
......
......@@ -3931,12 +3931,17 @@ bool HGraphBuilder::TryInline(Call* expr) {
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) {
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.
if (target->shared() == outer_info->closure()->shared()) {
......
......@@ -2787,10 +2787,32 @@ void LCodeGen::DoPower(LPower* instr) {
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);
}
......
......@@ -1224,7 +1224,13 @@ LInstruction* LChunkBuilder::DoCallConstantFunction(
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);
......
......@@ -11615,7 +11615,9 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CollectStackTrace) {
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()) {
......
......@@ -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 @@ Handle<JSArray> Isolate::CaptureCurrentStackTrace(
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.
......
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