Reviewers: Michael Starzinger,

Description:
[turbofan] Gracefully handle missing info()->context() in
CodeGenerator::IsMaterializableFromFrame()

[email protected]
BUG=

Please review this at https://codereview.chromium.org/1292233004/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+9, -1 lines):
  M src/compiler.h
  M src/compiler.cc
  M src/compiler/code-generator.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 8a0ea19b62caf3a70e1d929fa1b698cd2d07fd49..7e0f0fdfbcda8ed644ddd18ceaf0c4288d52b44b 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -102,6 +102,11 @@ bool CompilationInfo::has_shared_info() const {
 }


+bool CompilationInfo::has_context() const {
+  return parse_info_ && !parse_info_->context().is_null();
+}
+
+
 CompilationInfo::CompilationInfo(ParseInfo* parse_info)
     : CompilationInfo(parse_info, nullptr, BASE, parse_info->isolate(),
                       parse_info->zone()) {
Index: src/compiler.h
diff --git a/src/compiler.h b/src/compiler.h
index 78ae812970ca19658b8e67c5fac62effed7dfa21..6baddf19959dd3aed1efbcabc5f08bf7a9aa38c2 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -154,6 +154,7 @@ class CompilationInfo {
   Handle<Context> context() const;
   Handle<SharedFunctionInfo> shared_info() const;
   bool has_shared_info() const;
+  bool has_context() const;
   // -----------------------------------------------------------

   Isolate* isolate() const {
Index: src/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index 4f0b0390442d87dc8ba4f7a2446c502116ce68ed..203a9962d592e770c6a2ad8bcd7b94e2db6c6158 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -232,7 +232,8 @@ void CodeGenerator::RecordSafepoint(ReferenceMap* references,
 bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
                                               int* offset_return) {
   if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
-    if (object.is_identical_to(info()->context()) && !info()->is_osr()) {
+ if (info()->has_context() && object.is_identical_to(info()->context()) &&
+        !info()->is_osr()) {
       *offset_return = StandardFrameConstants::kContextOffset;
       return true;
     } else if (object.is_identical_to(info()->closure())) {
@@ -531,6 +532,7 @@ void CodeGenerator::BuildTranslationForFrameStateDescriptor(

   Handle<SharedFunctionInfo> shared_info;
   if (!descriptor->shared_info().ToHandle(&shared_info)) {
+ if (!info()->parse_info()) return; // TODO(titzer): that was unfortunate.
     shared_info = info()->shared_info();
   }
   int shared_info_id = DefineDeoptimizationLiteral(shared_info);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to