Scope* scope = node->scope();
if (scope->HasIllegalRedeclaration()) {
- scope->VisitIllegalRedeclaration(this);
+ Visit(scope->GetIllegalRedeclaration());
DisableOptimization(kFunctionWithIllegalRedeclaration);
return Finish(node);
}
// Visit illegal re-declaration and bail out if it exists.
if (scope->HasIllegalRedeclaration()) {
- AstEffectContext for_effect(this);
- scope->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope->GetIllegalRedeclaration());
return;
}
switch (function) {
case Runtime::kAllocateInTargetSpace:
case Runtime::kDateField:
- case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
case Runtime::kDefineClassMethod: // TODO(jarin): Is it safe?
case Runtime::kDefineGetterPropertyUnchecked: // TODO(jarin): Is it safe?
case Runtime::kDefineSetterPropertyUnchecked: // TODO(jarin): Is it safe?
+ case Runtime::kFinalizeClassDefinition: // TODO(conradw): Is it safe?
case Runtime::kForInDone:
case Runtime::kForInStep:
case Runtime::kGetOriginalConstructor:
case Runtime::kInlineGetCallerJSFunction:
case Runtime::kInlineGetPrototype:
case Runtime::kInlineRegExpExec:
+ case Runtime::kInlineSubString:
+ case Runtime::kInlineToName:
+ case Runtime::kInlineToNumber:
case Runtime::kInlineToObject:
- case Runtime::kInlineToPrimitive:
case Runtime::kInlineToPrimitive_Number:
case Runtime::kInlineToPrimitive_String:
- case Runtime::kInlineToNumber:
+ case Runtime::kInlineToPrimitive:
case Runtime::kInlineToString:
- case Runtime::kInlineToName:
return 1;
case Runtime::kInlineDeoptimizeNow:
case Runtime::kInlineThrowNotDateError:
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
// redeclaration.
if (scope()->HasIllegalRedeclaration()) {
Comment cmnt(masm_, "[ Declarations");
- scope()->VisitIllegalRedeclaration(this);
+ VisitForEffect(scope()->GetIllegalRedeclaration());
} else {
PrepareForBailoutForId(BailoutId::FunctionEntry(), NO_REGISTERS);
Object* script = fun->shared()->script();
if (script->IsScript() &&
!(Script::cast(script)->source()->IsUndefined())) {
- int pos = frame->LookupCode()->SourcePosition(frame->pc());
- // Compute the location from the function and the reloc info.
Handle<Script> casted_script(Script::cast(script));
+ // Compute the location from the function and the relocation info of the
+ // baseline code. For optimized code this will use the deoptimization
+ // information to get canonical location information.
+ List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
+ it.frame()->Summarize(&frames);
+ FrameSummary& summary = frames.last();
+ int pos = summary.code()->SourcePosition(summary.pc());
*target = MessageLocation(casted_script, pos, pos + 1, handle(fun));
return true;
}
}
-void Scope::VisitIllegalRedeclaration(AstVisitor* visitor) {
+Expression* Scope::GetIllegalRedeclaration() {
DCHECK(HasIllegalRedeclaration());
- illegal_redecl_->Accept(visitor);
+ return illegal_redecl_;
}
// the additional requests will be silently ignored.
void SetIllegalRedeclaration(Expression* expression);
- // Visit the illegal redeclaration expression. Do not call if the
+ // Retrieve the illegal redeclaration expression. Do not call if the
// scope doesn't have an illegal redeclaration node.
- void VisitIllegalRedeclaration(AstVisitor* visitor);
+ Expression* GetIllegalRedeclaration();
// Check if the scope has (at least) one illegal redeclaration.
bool HasIllegalRedeclaration() const { return illegal_redecl_ != NULL; }
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+(function() {
+ try {
+ [].foo();
+ } catch (e) {
+ throw e;
+ }
+})();
--- /dev/null
+# Copyright 2015 the V8 project authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+*%(basename)s:9: TypeError: [].foo is not a function
+ throw e;
+ ^
+TypeError: [].foo is not a function
+ at *%(basename)s:7:8
+ at *%(basename)s:11:3
--- /dev/null
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --turbo-filter=test --allow-natives-syntax
+
+function test() {
+ try {
+ [].foo();
+ } catch (e) {
+ return e.message;
+ }
+}
+
+assertEquals("[].foo is not a function", test());
+%OptimizeFunctionOnNextCall(test);
+assertEquals("[].foo is not a function", test());