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

Unified Diff: src/compiler.cc

Issue 137403009: Adding a type vector to replace type cells. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Seperate file for feedback slot allocation. Created 6 years, 11 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
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index b9e13c166172595b298ae227348f5a40a35dca20..163276997526034cecc34357200c7793814d075d 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -35,6 +35,7 @@
#include "cpu-profiler.h"
#include "debug.h"
#include "deoptimizer.h"
+#include "feedbackslots.h"
#include "full-codegen.h"
#include "gdb-jit.h"
#include "typing.h"
@@ -60,6 +61,7 @@ CompilationInfo::CompilationInfo(Handle<Script> script,
script_(script),
osr_ast_id_(BailoutId::None()),
parameter_count_(0),
+ feedback_slots_(-1),
danno 2014/01/28 08:27:17 Don't you want to use kInvalidFeedbackSlot here an
this_has_uses_(true) {
Initialize(script->GetIsolate(), BASE, zone);
}
@@ -72,6 +74,7 @@ CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
script_(Handle<Script>(Script::cast(shared_info->script()))),
osr_ast_id_(BailoutId::None()),
parameter_count_(0),
+ feedback_slots_(-1),
this_has_uses_(true) {
Initialize(script_->GetIsolate(), BASE, zone);
}
@@ -86,6 +89,7 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
context_(closure->context()),
osr_ast_id_(BailoutId::None()),
parameter_count_(0),
+ feedback_slots_(-1),
this_has_uses_(true) {
Initialize(script_->GetIsolate(), BASE, zone);
}
@@ -98,6 +102,7 @@ CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
IsLazy::encode(true)),
osr_ast_id_(BailoutId::None()),
parameter_count_(0),
+ feedback_slots_(0), // Hydrogen code stubs don't have feedback slots
this_has_uses_(true) {
Initialize(isolate, STUB, zone);
code_stub_ = stub;
@@ -365,6 +370,7 @@ OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() {
unoptimized.SetFunction(info()->function());
unoptimized.SetScope(info()->scope());
unoptimized.SetContext(info()->context());
+ FeedbackSlotAllocator::Run(&unoptimized);
if (should_recompile) unoptimized.EnableDeoptimizationSupport();
bool succeeded = FullCodeGenerator::MakeCode(&unoptimized);
if (should_recompile) {
@@ -613,6 +619,8 @@ static bool CompileUnoptimizedCode(CompilationInfo* info) {
if (!Rewriter::Rewrite(info)) return false;
if (!Scope::Analyze(info)) return false;
ASSERT(info->scope() != NULL);
+ if (!FeedbackSlotAllocator::Run(info)) return false;
+ ASSERT(info->feedback_slots() >= 0);
if (!FullCodeGenerator::MakeCode(info)) {
Isolate* isolate = info->isolate();
@@ -1007,7 +1015,8 @@ Handle<SharedFunctionInfo> Compiler::BuildFunctionInfo(FunctionLiteral* literal,
Handle<Code> code = isolate->builtins()->CompileUnoptimized();
info.SetCode(code);
scope_info = Handle<ScopeInfo>(ScopeInfo::Empty(isolate));
- } else if (FullCodeGenerator::MakeCode(&info)) {
+ } else if (FeedbackSlotAllocator::Run(&info) &&
+ FullCodeGenerator::MakeCode(&info)) {
ASSERT(!info.code().is_null());
scope_info = ScopeInfo::Create(info.scope(), info.zone());
} else {
@@ -1084,6 +1093,8 @@ static bool CompileOptimizedPrologue(CompilationInfo* info) {
if (!Rewriter::Rewrite(info)) return false;
if (!Scope::Analyze(info)) return false;
ASSERT(info->scope() != NULL);
+ if (!FeedbackSlotAllocator::Run(info)) return false;
+ ASSERT(info->feedback_slots() >= 0);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698