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

Unified Diff: src/full-codegen.cc

Issue 110203002: Refactor the compiling pipeline. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: move some code Created 7 years 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/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index a40b61e5c91f6b8854db0300f11dd247535404b4..aea45fb79a6283aabb16cd782e0e449dbb694fd9 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -312,6 +312,10 @@ void BreakableStatementChecker::VisitThisFunction(ThisFunction* expr) {
bool FullCodeGenerator::MakeCode(CompilationInfo* info) {
Isolate* isolate = info->isolate();
+
+ Logger::TimerEventScope timer(
+ isolate, Logger::TimerEventScope::v8_compile_full_code);
+
Handle<Script> script = info->script();
if (!script->IsUndefined() && !script->source()->IsUndefined()) {
int len = String::cast(script->source())->length();
@@ -1644,8 +1648,7 @@ bool FullCodeGenerator::TryLiteralCompare(CompareOperation* expr) {
}
-void BackEdgeTable::Patch(Isolate* isolate,
- Code* unoptimized) {
+void BackEdgeTable::Patch(Isolate* isolate, Code* unoptimized) {
DisallowHeapAllocation no_gc;
Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement);
@@ -1668,8 +1671,7 @@ void BackEdgeTable::Patch(Isolate* isolate,
}
-void BackEdgeTable::Revert(Isolate* isolate,
- Code* unoptimized) {
+void BackEdgeTable::Revert(Isolate* isolate, Code* unoptimized) {
DisallowHeapAllocation no_gc;
Code* patch = isolate->builtins()->builtin(Builtins::kInterruptCheck);
@@ -1694,14 +1696,10 @@ void BackEdgeTable::Revert(Isolate* isolate,
}
-void BackEdgeTable::AddStackCheck(CompilationInfo* info) {
+void BackEdgeTable::AddStackCheck(Code* code, uint32_t pc_offset) {
DisallowHeapAllocation no_gc;
- Isolate* isolate = info->isolate();
- Code* code = *info->osr_patched_code();
- Address pc = code->instruction_start() + info->osr_pc_offset();
- ASSERT_EQ(info->osr_ast_id().ToInt(),
- code->TranslatePcOffsetToAstId(info->osr_pc_offset()).ToInt());
- ASSERT_NE(INTERRUPT, GetBackEdgeState(isolate, code, pc));
+ Isolate* isolate = code->GetIsolate();
+ Address pc = code->instruction_start() + pc_offset;
Code* patch = isolate->builtins()->builtin(Builtins::kOsrAfterStackCheck);
PatchAt(code, pc, OSR_AFTER_STACK_CHECK, patch);
}
@@ -1710,14 +1708,21 @@ void BackEdgeTable::AddStackCheck(CompilationInfo* info) {
void BackEdgeTable::RemoveStackCheck(CompilationInfo* info) {
DisallowHeapAllocation no_gc;
Isolate* isolate = info->isolate();
- Code* code = *info->osr_patched_code();
- Address pc = code->instruction_start() + info->osr_pc_offset();
- ASSERT_EQ(info->osr_ast_id().ToInt(),
- code->TranslatePcOffsetToAstId(info->osr_pc_offset()).ToInt());
- if (GetBackEdgeState(isolate, code, pc) == OSR_AFTER_STACK_CHECK) {
- Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement);
- PatchAt(code, pc, ON_STACK_REPLACEMENT, patch);
+ Code* code = *info->unoptimized_code();
+ BailoutId target_id = info->osr_ast_id();
+ BackEdgeTable back_edges(code, &no_gc);
+
+ for (uint32_t i = 0; i < back_edges.length(); i++) {
titzer 2013/12/09 14:49:28 I'm not so sure about the assumption that the AST
Yang 2013/12/10 11:22:04 AST ids in the back edge table are taken from Iter
+ if (back_edges.ast_id(i) != target_id) continue;
+ if (OSR_AFTER_STACK_CHECK ==
+ GetBackEdgeState(isolate, code, back_edges.pc(i))) {
+ Code* patch = isolate->builtins()->builtin(Builtins::kOnStackReplacement);
+ PatchAt(code, back_edges.pc(i), ON_STACK_REPLACEMENT, patch);
+ }
+ ASSERT(Verify(isolate, code, code->allow_osr_at_loop_nesting_level()));
titzer 2013/12/09 14:49:28 Probably not going to work if you have a recursive
Yang 2013/12/10 11:22:04 Verify only tests that the back edge states are co
+ return;
}
+ UNREACHABLE(); // The target id should have been found in the loop.
}

Powered by Google App Engine
This is Rietveld 408576698