Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 50572201ccad153421ca1be23d1b7d62053f4815..9c03053afe09943eb4eff0aa9662fc82b84cfaec 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -100,6 +100,11 @@ class JumpPatchSite BASE_EMBEDDED { |
}; |
+int FullCodeGenerator::self_optimization_header_size() { |
+ return 20; |
+} |
+ |
+ |
// Generate code for a JS function. On entry to the function the receiver |
// and arguments have been pushed on the stack left to right, with the |
// return address on top of them. The actual argument count matches the |
@@ -120,13 +125,6 @@ void FullCodeGenerator::Generate() { |
SetFunctionPosition(function()); |
Comment cmnt(masm_, "[ function compiled by full code generator"); |
-#ifdef DEBUG |
- if (strlen(FLAG_stop_at) > 0 && |
- info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
- __ int3(); |
- } |
-#endif |
- |
// We can optionally optimize based on counters rather than statistical |
// sampling. |
if (info->ShouldSelfOptimize()) { |
@@ -134,6 +132,7 @@ void FullCodeGenerator::Generate() { |
PrintF("[adding self-optimization header to %s]\n", |
*info->function()->debug_name()->ToCString()); |
} |
+ has_self_optimization_header_ = true; |
MaybeObject* maybe_cell = isolate()->heap()->AllocateJSGlobalPropertyCell( |
Smi::FromInt(Compiler::kCallsUntilPrimitiveOpt)); |
JSGlobalPropertyCell* cell; |
@@ -145,9 +144,17 @@ void FullCodeGenerator::Generate() { |
Handle<Code> compile_stub( |
isolate()->builtins()->builtin(Builtins::kLazyRecompile)); |
__ j(zero, compile_stub, RelocInfo::CODE_TARGET); |
+ ASSERT(masm_->pc_offset() == self_optimization_header_size()); |
} |
} |
+#ifdef DEBUG |
+ if (strlen(FLAG_stop_at) > 0 && |
+ info->function()->name()->IsEqualTo(CStrVector(FLAG_stop_at))) { |
+ __ int3(); |
+ } |
+#endif |
+ |
// Strict mode functions and builtins need to replace the receiver |
// with undefined when called as functions (without an explicit |
// receiver object). rcx is zero for method calls and non-zero for |