Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index fcc0bd581363acc1be90a746c0af3492b7114f13..4857637f4da38933193f071d05dd04e819332317 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -355,8 +355,22 @@ void FullCodeGenerator::EmitReturnSequence() { |
{ Assembler::BlockConstPoolScope block_const_pool(masm_); |
// Here we use masm_-> instead of the __ macro to avoid the code coverage |
// tool from instrumenting as we rely on the code size here. |
- int32_t sp_delta = (info_->scope()->num_parameters() + 1) * kPointerSize; |
- CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
+ Scope* scope = function()->scope(); |
+ int32_t sp_delta = (scope->num_parameters() + 1) * kPointerSize; |
+ if (scope->is_function_scope()) { |
+ // Set the source position of the return sequence to the position |
+ // of the closing brace '}'. |
+ CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); |
Lasse Reichstein
2011/11/21 10:16:40
What if the function source doesn't have a closing
Steven
2011/11/24 13:23:31
Søren and I came up with a different scheme when d
|
+ } else { |
+ ASSERT(scope->is_global_scope() || scope->is_eval_scope()); |
+ // Set the source position to one character past the source code, such |
+ // that it definitely is not in the source code range of an immediate |
+ // inner scope. For example in |
+ // eval('with ({x:1}) x = 1'); |
+ // the end position of the function generated for executing the eval code |
+ // coincides with the end of the with scope which is the position of '1'. |
+ CodeGenerator::RecordPositions(masm_, function()->end_position()); |
+ } |
__ RecordJSReturn(); |
masm_->mov(sp, fp); |
masm_->ldm(ia_w, sp, fp.bit() | lr.bit()); |