Move RelocInfo::kNoPosition.
R=mstarzinger@chromium.org BUG=v8:5117 Review-Url: https://codereview.chromium.org/2109773004 Cr-Commit-Position: refs/heads/master@{#37426}
This commit is contained in:
parent
38b31043ec
commit
141cddc720
1
buffer
Normal file
1
buffer
Normal file
@ -0,0 +1 @@
|
||||
27,27,27,27,27,66,66,66,66,105,105,216,216,216,216,280,280,280,293,293,293,301,301,301,317
|
48
patch
Normal file
48
patch
Normal file
@ -0,0 +1,48 @@
|
||||
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
||||
index 5624e3f..81936c1 100644
|
||||
--- a/test/cctest/test-api.cc
|
||||
+++ b/test/cctest/test-api.cc
|
||||
@@ -17049,6 +17049,43 @@ TEST(CaptureStackTraceForUncaughtExceptionAndSetters) {
|
||||
}
|
||||
|
||||
|
||||
+static void StackTraceFunctionNameListenerForEval(v8::Local<v8::Message> message,
|
||||
+ v8::Local<Value>) {
|
||||
+ v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
|
||||
+ for (int i = 0; i < stack_trace->GetFrameCount(); i++) {
|
||||
+ v8::Local<v8::StackFrame> frame = stack_trace->GetFrame(i);
|
||||
+ v8::String::Utf8Value func_name(frame->GetFunctionName());
|
||||
+ v8::String::Utf8Value script_name(frame->GetScriptName());
|
||||
+ printf("%s:%s, %d,%d\n", *script_name, *func_name, frame->GetLineNumber(), frame->GetColumn());
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ CHECK_EQ(5, stack_trace->GetFrameCount());
|
||||
+ checkStackFrame("origin", "foo:0", 4, 7, false, false,
|
||||
+ stack_trace->GetFrame(0));
|
||||
+ checkStackFrame("origin", "foo:1", 5, 27, false, false,
|
||||
+ stack_trace->GetFrame(1));
|
||||
+ checkStackFrame("origin", "foo", 5, 27, false, false,
|
||||
+ stack_trace->GetFrame(2));
|
||||
+ checkStackFrame("origin", "foo", 5, 27, false, false,
|
||||
+ stack_trace->GetFrame(3));
|
||||
+ checkStackFrame("origin", "", 1, 14, false, false, stack_trace->GetFrame(4));
|
||||
+}
|
||||
+
|
||||
+
|
||||
+TEST(CaptureStackTraceForUncaughtExceptionInEval) {
|
||||
+ LocalContext env;
|
||||
+ v8::Isolate* isolate = env->GetIsolate();
|
||||
+ v8::HandleScope scope(isolate);
|
||||
+ isolate->SetCaptureStackTraceForUncaughtExceptions(true, 1024,
|
||||
+ v8::StackTrace::kDetailed);
|
||||
+ isolate->AddMessageListener(StackTraceFunctionNameListenerForEval);
|
||||
+
|
||||
+ CompileRun("eval('throw new Error()');");
|
||||
+ isolate->SetCaptureStackTraceForUncaughtExceptions(false);
|
||||
+}
|
||||
+
|
||||
+
|
||||
static void StackTraceFunctionNameListener(v8::Local<v8::Message> message,
|
||||
v8::Local<Value>) {
|
||||
v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
|
@ -38,6 +38,7 @@
|
||||
#include "src/execution.h"
|
||||
#include "src/gdb-jit.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/icu_util.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/json-parser.h"
|
||||
@ -2112,7 +2113,7 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
|
||||
|
||||
i::Handle<i::Object> name_obj;
|
||||
int eval_scope_position = 0;
|
||||
int eval_position = i::RelocInfo::kNoPosition;
|
||||
int eval_position = i::kNoSourcePosition;
|
||||
int line_offset = 0;
|
||||
int column_offset = 0;
|
||||
if (!source->resource_name.IsEmpty()) {
|
||||
|
@ -352,17 +352,6 @@ enum ICacheFlushMode { FLUSH_ICACHE_IF_NEEDED, SKIP_ICACHE_FLUSH };
|
||||
|
||||
class RelocInfo {
|
||||
public:
|
||||
// The constant kNoPosition is used with the collecting of source positions
|
||||
// in the relocation information. Two types of source positions are collected
|
||||
// "position" (RelocMode position) and "statement position" (RelocMode
|
||||
// statement_position). The "position" is collected at places in the source
|
||||
// code which are of interest when making stack traces to pin-point the source
|
||||
// location of a stack frame as close as possible. The "statement position" is
|
||||
// collected at the beginning at each statement, and is used to indicate
|
||||
// possible break locations. kNoPosition is used to indicate an
|
||||
// invalid/uninitialized position value.
|
||||
static const int kNoPosition = -1;
|
||||
|
||||
// This string is used to add padding comments to the reloc info in cases
|
||||
// where we are not sure to have enough space for patching in during
|
||||
// lazy deoptimization. This is the case if we have indirect calls for which
|
||||
|
@ -5,7 +5,6 @@
|
||||
#ifndef V8_AST_AST_H_
|
||||
#define V8_AST_AST_H_
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/ast/ast-value-factory.h"
|
||||
#include "src/ast/modules.h"
|
||||
#include "src/ast/variables.h"
|
||||
@ -13,6 +12,7 @@
|
||||
#include "src/base/flags.h"
|
||||
#include "src/base/smart-pointers.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/isolate.h"
|
||||
#include "src/list.h"
|
||||
#include "src/parsing/token.h"
|
||||
@ -1263,7 +1263,7 @@ class SloppyBlockFunctionStatement final : public Statement {
|
||||
|
||||
private:
|
||||
SloppyBlockFunctionStatement(Zone* zone, Statement* statement, Scope* scope)
|
||||
: Statement(zone, RelocInfo::kNoPosition),
|
||||
: Statement(zone, kNoSourcePosition),
|
||||
statement_(statement),
|
||||
scope_(scope) {}
|
||||
|
||||
@ -2704,7 +2704,7 @@ class FunctionLiteral final : public Expression {
|
||||
materialized_literal_count_(materialized_literal_count),
|
||||
expected_property_count_(expected_property_count),
|
||||
parameter_count_(parameter_count),
|
||||
function_token_position_(RelocInfo::kNoPosition),
|
||||
function_token_position_(kNoSourcePosition),
|
||||
yield_count_(0) {
|
||||
bitfield_ =
|
||||
FunctionTypeBits::encode(function_type) | Pretenure::encode(false) |
|
||||
@ -3292,16 +3292,16 @@ class AstNodeFactory final BASE_EMBEDDED {
|
||||
}
|
||||
|
||||
VariableProxy* NewVariableProxy(Variable* var,
|
||||
int start_position = RelocInfo::kNoPosition,
|
||||
int end_position = RelocInfo::kNoPosition) {
|
||||
int start_position = kNoSourcePosition,
|
||||
int end_position = kNoSourcePosition) {
|
||||
return new (parser_zone_)
|
||||
VariableProxy(parser_zone_, var, start_position, end_position);
|
||||
}
|
||||
|
||||
VariableProxy* NewVariableProxy(const AstRawString* name,
|
||||
Variable::Kind variable_kind,
|
||||
int start_position = RelocInfo::kNoPosition,
|
||||
int end_position = RelocInfo::kNoPosition) {
|
||||
int start_position = kNoSourcePosition,
|
||||
int end_position = kNoSourcePosition) {
|
||||
DCHECK_NOT_NULL(name);
|
||||
return new (parser_zone_) VariableProxy(parser_zone_, name, variable_kind,
|
||||
start_position, end_position);
|
||||
|
@ -194,8 +194,8 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
|
||||
rest_parameter_ = NULL;
|
||||
rest_index_ = -1;
|
||||
scope_info_ = scope_info;
|
||||
start_position_ = RelocInfo::kNoPosition;
|
||||
end_position_ = RelocInfo::kNoPosition;
|
||||
start_position_ = kNoSourcePosition;
|
||||
end_position_ = kNoSourcePosition;
|
||||
is_hidden_ = false;
|
||||
if (!scope_info.is_null()) {
|
||||
scope_calls_eval_ = scope_info->CallsEval();
|
||||
@ -455,8 +455,8 @@ Variable* Scope::LookupFunctionVar(const AstRawString* name,
|
||||
Variable* var = new (zone())
|
||||
Variable(this, name, mode, Variable::NORMAL, kCreatedInitialized);
|
||||
VariableProxy* proxy = factory->NewVariableProxy(var);
|
||||
VariableDeclaration* declaration = factory->NewVariableDeclaration(
|
||||
proxy, mode, this, RelocInfo::kNoPosition);
|
||||
VariableDeclaration* declaration =
|
||||
factory->NewVariableDeclaration(proxy, mode, this, kNoSourcePosition);
|
||||
DeclareFunctionVar(declaration);
|
||||
var->AllocateTo(VariableLocation::CONTEXT, index);
|
||||
return var;
|
||||
@ -1016,8 +1016,8 @@ void Scope::CheckScopePositions() {
|
||||
// A scope is allowed to have invalid positions if it is hidden and has no
|
||||
// inner scopes
|
||||
if (!is_hidden() && inner_scopes_.length() == 0) {
|
||||
CHECK_NE(RelocInfo::kNoPosition, start_position());
|
||||
CHECK_NE(RelocInfo::kNoPosition, end_position());
|
||||
CHECK_NE(kNoSourcePosition, start_position());
|
||||
CHECK_NE(kNoSourcePosition, end_position());
|
||||
}
|
||||
for (Scope* scope : inner_scopes_) scope->CheckScopePositions();
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/base/hashmap.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/pending-compilation-error-handler.h"
|
||||
#include "src/zone.h"
|
||||
|
||||
@ -174,8 +175,8 @@ class Scope: public ZoneObject {
|
||||
VariableProxy* NewUnresolved(AstNodeFactory* factory,
|
||||
const AstRawString* name,
|
||||
Variable::Kind kind = Variable::NORMAL,
|
||||
int start_position = RelocInfo::kNoPosition,
|
||||
int end_position = RelocInfo::kNoPosition) {
|
||||
int start_position = kNoSourcePosition,
|
||||
int end_position = kNoSourcePosition) {
|
||||
// Note that we must not share the unresolved variables with
|
||||
// the same name because they may be removed selectively via
|
||||
// RemoveUnresolved().
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "src/ast/ast.h"
|
||||
#include "src/ast/scopes.h"
|
||||
#include "src/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
@ -28,7 +29,6 @@ const char* Variable::Mode2String(VariableMode mode) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
|
||||
Kind kind, InitializationFlag initialization_flag,
|
||||
MaybeAssignedFlag maybe_assigned_flag)
|
||||
@ -38,7 +38,7 @@ Variable::Variable(Scope* scope, const AstRawString* name, VariableMode mode,
|
||||
kind_(kind),
|
||||
location_(VariableLocation::UNALLOCATED),
|
||||
index_(-1),
|
||||
initializer_position_(RelocInfo::kNoPosition),
|
||||
initializer_position_(kNoSourcePosition),
|
||||
local_if_not_shadowed_(NULL),
|
||||
force_context_allocation_(false),
|
||||
is_used_(false),
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/elements.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/gdb-jit.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/ic/handler-compiler.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/isolate-inl.h"
|
||||
@ -2183,7 +2184,7 @@ MaybeHandle<JSFunction> CompileString(Handle<Context> context,
|
||||
|
||||
// Compile source string in the native context.
|
||||
int eval_scope_position = 0;
|
||||
int eval_position = RelocInfo::kNoPosition;
|
||||
int eval_position = kNoSourcePosition;
|
||||
Handle<SharedFunctionInfo> outer_info(native_context->closure()->shared());
|
||||
return Compiler::GetFunctionFromEval(source, outer_info, native_context,
|
||||
SLOPPY, restriction, eval_scope_position,
|
||||
|
@ -4,9 +4,9 @@
|
||||
|
||||
#include "src/compilation-cache.h"
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/counters.h"
|
||||
#include "src/factory.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/objects-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -308,7 +308,7 @@ MaybeHandle<SharedFunctionInfo> CompilationCache::LookupEval(
|
||||
result =
|
||||
eval_global_.Lookup(source, outer_info, language_mode, scope_position);
|
||||
} else {
|
||||
DCHECK(scope_position != RelocInfo::kNoPosition);
|
||||
DCHECK(scope_position != kNoSourcePosition);
|
||||
result = eval_contextual_.Lookup(source, outer_info, language_mode,
|
||||
scope_position);
|
||||
}
|
||||
@ -345,7 +345,7 @@ void CompilationCache::PutEval(Handle<String> source,
|
||||
if (context->IsNativeContext()) {
|
||||
eval_global_.Put(source, outer_info, function_info, scope_position);
|
||||
} else {
|
||||
DCHECK(scope_position != RelocInfo::kNoPosition);
|
||||
DCHECK(scope_position != kNoSourcePosition);
|
||||
eval_contextual_.Put(source, outer_info, function_info, scope_position);
|
||||
}
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/full-codegen/full-codegen.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/log-inl.h"
|
||||
@ -1099,7 +1100,7 @@ Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
|
||||
TRACE_EVENT0("v8", parse_info->is_eval() ? "V8.CompileEval" : "V8.Compile");
|
||||
|
||||
// Allocate a shared function info object.
|
||||
DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
|
||||
DCHECK_EQ(kNoSourcePosition, lit->function_token_position());
|
||||
result = NewSharedFunctionInfoForLiteral(isolate, lit, script);
|
||||
result->set_is_toplevel(true);
|
||||
if (parse_info->is_eval()) {
|
||||
|
@ -5,8 +5,8 @@
|
||||
#ifndef V8_COMPILER_SOURCE_POSITION_H_
|
||||
#define V8_COMPILER_SOURCE_POSITION_H_
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/compiler/node-aux-data.h"
|
||||
#include "src/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
@ -25,7 +25,7 @@ class SourcePosition final {
|
||||
int raw() const { return raw_; }
|
||||
|
||||
private:
|
||||
static const int kUnknownPosition = RelocInfo::kNoPosition;
|
||||
static const int kUnknownPosition = kNoSourcePosition;
|
||||
int raw_;
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/crankshaft/hydrogen-types.h"
|
||||
#include "src/crankshaft/unique.h"
|
||||
#include "src/deoptimizer.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/small-pointer-list.h"
|
||||
#include "src/utils.h"
|
||||
#include "src/zone.h"
|
||||
@ -1113,7 +1114,7 @@ class HInstruction : public HValue {
|
||||
: HValue(type),
|
||||
next_(NULL),
|
||||
previous_(NULL),
|
||||
position_(RelocInfo::kNoPosition) {
|
||||
position_(kNoSourcePosition) {
|
||||
SetDependsOnFlag(kOsrEntries);
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "src/crankshaft/typing.h"
|
||||
#include "src/field-type.h"
|
||||
#include "src/full-codegen/full-codegen.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/ic/call-optimization.h"
|
||||
#include "src/ic/ic.h"
|
||||
// GetRootConstructor
|
||||
@ -78,7 +79,7 @@ class HOptimizedGraphBuilderWithPositions : public HOptimizedGraphBuilder {
|
||||
#define DEF_VISIT(type) \
|
||||
void Visit##type(type* node) override { \
|
||||
SourcePosition old_position = SourcePosition::Unknown(); \
|
||||
if (node->position() != RelocInfo::kNoPosition) { \
|
||||
if (node->position() != kNoSourcePosition) { \
|
||||
old_position = source_position(); \
|
||||
SetSourcePosition(node->position()); \
|
||||
} \
|
||||
@ -93,7 +94,7 @@ class HOptimizedGraphBuilderWithPositions : public HOptimizedGraphBuilder {
|
||||
#define DEF_VISIT(type) \
|
||||
void Visit##type(type* node) override { \
|
||||
SourcePosition old_position = SourcePosition::Unknown(); \
|
||||
if (node->position() != RelocInfo::kNoPosition) { \
|
||||
if (node->position() != kNoSourcePosition) { \
|
||||
old_position = source_position(); \
|
||||
SetSourcePosition(node->position()); \
|
||||
} \
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "src/compiler.h"
|
||||
#include "src/crankshaft/compilation-phase.h"
|
||||
#include "src/crankshaft/hydrogen-instructions.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/parsing/parser.h"
|
||||
#include "src/zone.h"
|
||||
|
||||
@ -1923,7 +1924,7 @@ class HGraphBuilder {
|
||||
|
||||
protected:
|
||||
void SetSourcePosition(int position) {
|
||||
if (position != RelocInfo::kNoPosition) {
|
||||
if (position != kNoSourcePosition) {
|
||||
position_.set_position(position - start_position_);
|
||||
}
|
||||
// Otherwise position remains unknown.
|
||||
@ -1940,7 +1941,7 @@ class HGraphBuilder {
|
||||
// the SourcePosition assuming that this position corresponds to the
|
||||
// same function as current position_.
|
||||
SourcePosition ScriptPositionToSourcePosition(int position) {
|
||||
if (position == RelocInfo::kNoPosition) {
|
||||
if (position == kNoSourcePosition) {
|
||||
return SourcePosition::Unknown();
|
||||
}
|
||||
SourcePosition pos = position_;
|
||||
|
@ -37,6 +37,8 @@
|
||||
#error Unsupported target architecture.
|
||||
#endif
|
||||
|
||||
#include "src/globals.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
|
||||
@ -137,7 +139,7 @@ void LCodeGenBase::CheckEnvironmentUsage() {
|
||||
}
|
||||
|
||||
void LCodeGenBase::RecordAndWritePosition(int pos) {
|
||||
if (pos == RelocInfo::kNoPosition) return;
|
||||
if (pos == kNoSourcePosition) return;
|
||||
source_position_table_builder_.AddPosition(masm_->pc_offset(), pos, false);
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,11 @@
|
||||
|
||||
#include "src/accessors.h"
|
||||
#include "src/contexts.h"
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/debug/debug-frames.h"
|
||||
#include "src/debug/debug-scopes.h"
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/isolate-inl.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -98,9 +99,9 @@ MaybeHandle<Object> DebugEvaluate::Evaluate(
|
||||
Handle<JSFunction> eval_fun;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, eval_fun,
|
||||
Compiler::GetFunctionFromEval(
|
||||
source, outer_info, context, SLOPPY, NO_PARSE_RESTRICTION,
|
||||
RelocInfo::kNoPosition, RelocInfo::kNoPosition),
|
||||
Compiler::GetFunctionFromEval(source, outer_info, context, SLOPPY,
|
||||
NO_PARSE_RESTRICTION, kNoSourcePosition,
|
||||
kNoSourcePosition),
|
||||
Object);
|
||||
|
||||
Handle<Object> result;
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/full-codegen/full-codegen.h"
|
||||
#include "src/global-handles.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/list.h"
|
||||
@ -466,7 +467,7 @@ void Debug::ThreadInit() {
|
||||
thread_local_.break_id_ = 0;
|
||||
thread_local_.break_frame_id_ = StackFrame::NO_ID;
|
||||
thread_local_.last_step_action_ = StepNone;
|
||||
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
|
||||
thread_local_.last_statement_position_ = kNoSourcePosition;
|
||||
thread_local_.last_fp_ = 0;
|
||||
thread_local_.target_fp_ = 0;
|
||||
thread_local_.return_value_ = Handle<Object>();
|
||||
@ -1070,7 +1071,7 @@ void Debug::PrepareStep(StepAction step_action) {
|
||||
thread_local_.target_fp_ = frames_it.frame()->UnpaddedFP();
|
||||
}
|
||||
// Clear last position info. For stepping out it does not matter.
|
||||
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
|
||||
thread_local_.last_statement_position_ = kNoSourcePosition;
|
||||
thread_local_.last_fp_ = 0;
|
||||
break;
|
||||
case StepNext:
|
||||
@ -1131,7 +1132,7 @@ void Debug::ClearStepping() {
|
||||
ClearOneShot();
|
||||
|
||||
thread_local_.last_step_action_ = StepNone;
|
||||
thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
|
||||
thread_local_.last_statement_position_ = kNoSourcePosition;
|
||||
thread_local_.last_fp_ = 0;
|
||||
thread_local_.target_fp_ = 0;
|
||||
}
|
||||
@ -1393,13 +1394,13 @@ class SharedFunctionInfoFinder {
|
||||
explicit SharedFunctionInfoFinder(int target_position)
|
||||
: current_candidate_(NULL),
|
||||
current_candidate_closure_(NULL),
|
||||
current_start_position_(RelocInfo::kNoPosition),
|
||||
current_start_position_(kNoSourcePosition),
|
||||
target_position_(target_position) {}
|
||||
|
||||
void NewCandidate(SharedFunctionInfo* shared, JSFunction* closure = NULL) {
|
||||
if (!shared->IsSubjectToDebugging()) return;
|
||||
int start_position = shared->function_token_position();
|
||||
if (start_position == RelocInfo::kNoPosition) {
|
||||
if (start_position == kNoSourcePosition) {
|
||||
start_position = shared->start_position();
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/debug/liveedit.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/isolate-inl.h"
|
||||
#include "src/macro-assembler.h"
|
||||
#include "src/snapshot/snapshot.h"
|
||||
@ -600,12 +601,12 @@ void FullCodeGenerator::EmitHasProperty() {
|
||||
}
|
||||
|
||||
void FullCodeGenerator::RecordStatementPosition(int pos) {
|
||||
DCHECK_NE(RelocInfo::kNoPosition, pos);
|
||||
DCHECK_NE(kNoSourcePosition, pos);
|
||||
source_position_table_builder_.AddPosition(masm_->pc_offset(), pos, true);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::RecordPosition(int pos) {
|
||||
DCHECK_NE(RelocInfo::kNoPosition, pos);
|
||||
DCHECK_NE(kNoSourcePosition, pos);
|
||||
source_position_table_builder_.AddPosition(masm_->pc_offset(), pos, false);
|
||||
}
|
||||
|
||||
@ -629,7 +630,7 @@ void FullCodeGenerator::SetReturnPosition(FunctionLiteral* fun) {
|
||||
|
||||
void FullCodeGenerator::SetStatementPosition(
|
||||
Statement* stmt, FullCodeGenerator::InsertBreak insert_break) {
|
||||
if (stmt->position() == RelocInfo::kNoPosition) return;
|
||||
if (stmt->position() == kNoSourcePosition) return;
|
||||
RecordStatementPosition(stmt->position());
|
||||
if (insert_break == INSERT_BREAK && info_->is_debug() &&
|
||||
!stmt->IsDebuggerStatement()) {
|
||||
@ -638,13 +639,13 @@ void FullCodeGenerator::SetStatementPosition(
|
||||
}
|
||||
|
||||
void FullCodeGenerator::SetExpressionPosition(Expression* expr) {
|
||||
if (expr->position() == RelocInfo::kNoPosition) return;
|
||||
if (expr->position() == kNoSourcePosition) return;
|
||||
RecordPosition(expr->position());
|
||||
}
|
||||
|
||||
|
||||
void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) {
|
||||
if (expr->position() == RelocInfo::kNoPosition) return;
|
||||
if (expr->position() == kNoSourcePosition) return;
|
||||
RecordStatementPosition(expr->position());
|
||||
if (info_->is_debug()) {
|
||||
DebugCodegen::GenerateSlot(masm_, RelocInfo::DEBUG_BREAK_SLOT_AT_POSITION);
|
||||
@ -653,7 +654,7 @@ void FullCodeGenerator::SetExpressionAsStatementPosition(Expression* expr) {
|
||||
|
||||
void FullCodeGenerator::SetCallPosition(Expression* expr,
|
||||
TailCallMode tail_call_mode) {
|
||||
if (expr->position() == RelocInfo::kNoPosition) return;
|
||||
if (expr->position() == kNoSourcePosition) return;
|
||||
RecordPosition(expr->position());
|
||||
if (info_->is_debug()) {
|
||||
RelocInfo::Mode mode = (tail_call_mode == TailCallMode::kAllow)
|
||||
@ -1964,8 +1965,8 @@ bool FullCodeGenerator::NeedsHoleCheckForLoad(VariableProxy* proxy) {
|
||||
}
|
||||
|
||||
// Check that we always have valid source position.
|
||||
DCHECK(var->initializer_position() != RelocInfo::kNoPosition);
|
||||
DCHECK(proxy->position() != RelocInfo::kNoPosition);
|
||||
DCHECK(var->initializer_position() != kNoSourcePosition);
|
||||
DCHECK(proxy->position() != kNoSourcePosition);
|
||||
|
||||
return var->scope()->is_nonlinear() ||
|
||||
var->initializer_position() >= proxy->position();
|
||||
|
@ -293,6 +293,8 @@ inline LanguageMode construct_language_mode(bool strict_bit) {
|
||||
return static_cast<LanguageMode>(strict_bit);
|
||||
}
|
||||
|
||||
// This constant is used as an undefined value when passing source positions.
|
||||
const int kNoSourcePosition = -1;
|
||||
|
||||
// Mask for the sign bit in a smi.
|
||||
const intptr_t kSmiSignMask = kIntptrSignBit;
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "src/interpreter/bytecode-array-builder.h"
|
||||
|
||||
#include "src/compiler.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/interpreter/bytecode-array-writer.h"
|
||||
#include "src/interpreter/bytecode-dead-code-optimizer.h"
|
||||
#include "src/interpreter/bytecode-label.h"
|
||||
@ -52,7 +53,7 @@ BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone,
|
||||
|
||||
return_position_ =
|
||||
literal ? std::max(literal->start_position(), literal->end_position() - 1)
|
||||
: RelocInfo::kNoPosition;
|
||||
: kNoSourcePosition;
|
||||
}
|
||||
|
||||
Register BytecodeArrayBuilder::first_context_register() const {
|
||||
@ -443,7 +444,7 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfNotHole(
|
||||
}
|
||||
|
||||
BytecodeArrayBuilder& BytecodeArrayBuilder::StackCheck(int position) {
|
||||
if (position != RelocInfo::kNoPosition) {
|
||||
if (position != kNoSourcePosition) {
|
||||
// We need to attach a non-breakable source position to a stack
|
||||
// check, so we simply add it as expression position. There can be
|
||||
// a prior statement position from constructs like:
|
||||
@ -631,17 +632,17 @@ size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
|
||||
}
|
||||
|
||||
void BytecodeArrayBuilder::SetReturnPosition() {
|
||||
if (return_position_ == RelocInfo::kNoPosition) return;
|
||||
if (return_position_ == kNoSourcePosition) return;
|
||||
latest_source_info_.MakeStatementPosition(return_position_);
|
||||
}
|
||||
|
||||
void BytecodeArrayBuilder::SetStatementPosition(Statement* stmt) {
|
||||
if (stmt->position() == RelocInfo::kNoPosition) return;
|
||||
if (stmt->position() == kNoSourcePosition) return;
|
||||
latest_source_info_.MakeStatementPosition(stmt->position());
|
||||
}
|
||||
|
||||
void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) {
|
||||
if (expr->position() == RelocInfo::kNoPosition) return;
|
||||
if (expr->position() == kNoSourcePosition) return;
|
||||
if (!latest_source_info_.is_statement()) {
|
||||
// Ensure the current expression position is overwritten with the
|
||||
// latest value.
|
||||
@ -650,7 +651,7 @@ void BytecodeArrayBuilder::SetExpressionPosition(Expression* expr) {
|
||||
}
|
||||
|
||||
void BytecodeArrayBuilder::SetExpressionAsStatementPosition(Expression* expr) {
|
||||
if (expr->position() == RelocInfo::kNoPosition) return;
|
||||
if (expr->position() == kNoSourcePosition) return;
|
||||
latest_source_info_.MakeStatementPosition(expr->position());
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "src/field-type.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/full-codegen/full-codegen.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/ic/ic.h"
|
||||
#include "src/identity-map.h"
|
||||
#include "src/interpreter/bytecode-array-iterator.h"
|
||||
@ -12706,7 +12707,7 @@ void Oddball::Initialize(Isolate* isolate, Handle<Oddball> oddball,
|
||||
void Script::SetEvalOrigin(Handle<Script> script,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
int eval_position) {
|
||||
if (eval_position == RelocInfo::kNoPosition) {
|
||||
if (eval_position == kNoSourcePosition) {
|
||||
// If the position is missing, attempt to get the code offset from the
|
||||
// current activation. Do not translate the code offset into source
|
||||
// position, but store it as negative value for lazy translation.
|
||||
@ -17077,7 +17078,7 @@ Handle<Object> CompilationCacheTable::Lookup(Handle<String> src,
|
||||
LanguageMode language_mode) {
|
||||
Isolate* isolate = GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
||||
StringSharedKey key(src, shared, language_mode, RelocInfo::kNoPosition);
|
||||
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
|
||||
int entry = FindEntry(&key);
|
||||
if (entry == kNotFound) return isolate->factory()->undefined_value();
|
||||
int index = EntryToIndex(entry);
|
||||
@ -17117,7 +17118,7 @@ Handle<CompilationCacheTable> CompilationCacheTable::Put(
|
||||
Handle<Context> context, LanguageMode language_mode, Handle<Object> value) {
|
||||
Isolate* isolate = cache->GetIsolate();
|
||||
Handle<SharedFunctionInfo> shared(context->closure()->shared());
|
||||
StringSharedKey key(src, shared, language_mode, RelocInfo::kNoPosition);
|
||||
StringSharedKey key(src, shared, language_mode, kNoSourcePosition);
|
||||
Handle<Object> k = key.AsHandle(isolate);
|
||||
cache = EnsureCapacity(cache, 1, &key);
|
||||
int entry = cache->FindInsertionEntry(key.Hash());
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "src/ast/scopes.h"
|
||||
#include "src/bailout-reason.h"
|
||||
#include "src/base/hashmap.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/messages.h"
|
||||
#include "src/parsing/expression-classifier.h"
|
||||
#include "src/parsing/func-name-inferrer.h"
|
||||
@ -1978,7 +1979,7 @@ ParserBase<Traits>::ParsePropertyDefinition(
|
||||
classifier->Accumulate(&rhs_classifier,
|
||||
ExpressionClassifier::ExpressionProductions);
|
||||
value = factory()->NewAssignment(Token::ASSIGN, lhs, rhs,
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition);
|
||||
classifier->RecordCoverInitializedNameError(
|
||||
Scanner::Location(next_beg_pos, scanner()->location().end_pos),
|
||||
MessageTemplate::kInvalidCoverInitializedName);
|
||||
@ -2032,8 +2033,8 @@ ParserBase<Traits>::ParsePropertyDefinition(
|
||||
|
||||
value = this->ParseFunctionLiteral(
|
||||
*name, scanner()->location(), kSkipFunctionNameCheck, kind,
|
||||
RelocInfo::kNoPosition, FunctionLiteral::kAccessorOrMethod,
|
||||
language_mode(), CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
|
||||
kNoSourcePosition, FunctionLiteral::kAccessorOrMethod, language_mode(),
|
||||
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
|
||||
|
||||
return factory()->NewObjectLiteralProperty(name_expression, value,
|
||||
ObjectLiteralProperty::COMPUTED,
|
||||
@ -2071,8 +2072,8 @@ ParserBase<Traits>::ParsePropertyDefinition(
|
||||
typename Traits::Type::FunctionLiteral value = this->ParseFunctionLiteral(
|
||||
*name, scanner()->location(), kSkipFunctionNameCheck,
|
||||
is_get ? FunctionKind::kGetterFunction : FunctionKind::kSetterFunction,
|
||||
RelocInfo::kNoPosition, FunctionLiteral::kAccessorOrMethod,
|
||||
language_mode(), CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
|
||||
kNoSourcePosition, FunctionLiteral::kAccessorOrMethod, language_mode(),
|
||||
CHECK_OK_CUSTOM(EmptyObjectLiteralProperty));
|
||||
|
||||
// Make sure the name expression is a string since we need a Name for
|
||||
// Runtime_DefineAccessorPropertyUnchecked and since we can determine this
|
||||
@ -3365,7 +3366,7 @@ ParserBase<Traits>::ParseArrowFunctionLiteral(
|
||||
}
|
||||
} else {
|
||||
body = this->ParseEagerFunctionBody(
|
||||
this->EmptyIdentifier(), RelocInfo::kNoPosition, formal_parameters,
|
||||
this->EmptyIdentifier(), kNoSourcePosition, formal_parameters,
|
||||
arrow_kind, FunctionLiteral::kAnonymousExpression, CHECK_OK);
|
||||
materialized_literal_count =
|
||||
function_state.materialized_literal_count();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -505,7 +505,7 @@ class ParserTraits {
|
||||
const AstRawString* GetNumberAsSymbol(Scanner* scanner);
|
||||
|
||||
Expression* ThisExpression(Scope* scope, AstNodeFactory* factory,
|
||||
int pos = RelocInfo::kNoPosition);
|
||||
int pos = kNoSourcePosition);
|
||||
Expression* SuperPropertyReference(Scope* scope, AstNodeFactory* factory,
|
||||
int pos);
|
||||
Expression* SuperCallReference(Scope* scope, AstNodeFactory* factory,
|
||||
@ -971,7 +971,7 @@ class Parser : public ParserBase<ParserTraits> {
|
||||
int each_keyword_pos);
|
||||
void InitializeForOfStatement(ForOfStatement* stmt, Expression* each,
|
||||
Expression* iterable, Statement* body,
|
||||
int next_result_pos = RelocInfo::kNoPosition);
|
||||
int next_result_pos = kNoSourcePosition);
|
||||
Statement* DesugarLexicalBindingsInForStatement(
|
||||
Scope* inner_scope, VariableMode mode,
|
||||
ZoneList<const AstRawString*>* names, ForStatement* loop, Statement* init,
|
||||
|
@ -159,7 +159,7 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
|
||||
DCHECK(!proxy->is_resolved() || proxy->var() == var);
|
||||
var->set_initializer_position(initializer_position_);
|
||||
|
||||
DCHECK(initializer_position_ != RelocInfo::kNoPosition);
|
||||
DCHECK(initializer_position_ != kNoSourcePosition);
|
||||
|
||||
Scope* declaration_scope = IsLexicalVariableMode(descriptor_->mode)
|
||||
? descriptor_->scope
|
||||
@ -248,7 +248,7 @@ void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) {
|
||||
// We may want to pass singleton to avoid Literal allocations.
|
||||
LanguageMode language_mode = initialization_scope->language_mode();
|
||||
arguments->Add(
|
||||
factory()->NewNumberLiteral(language_mode, RelocInfo::kNoPosition),
|
||||
factory()->NewNumberLiteral(language_mode, kNoSourcePosition),
|
||||
zone());
|
||||
|
||||
// Be careful not to assign a value to the global variable if
|
||||
@ -310,10 +310,10 @@ Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) {
|
||||
if (value != nullptr) {
|
||||
auto assignment = factory()->NewAssignment(
|
||||
Token::ASSIGN, factory()->NewVariableProxy(temp), value,
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition);
|
||||
|
||||
block_->statements()->Add(
|
||||
factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition),
|
||||
factory()->NewExpressionStatement(assignment, kNoSourcePosition),
|
||||
zone());
|
||||
}
|
||||
return temp;
|
||||
@ -348,11 +348,10 @@ void Parser::PatternRewriter::VisitRewritableExpression(
|
||||
auto temp_var = CreateTempVar(current_value_);
|
||||
Expression* is_undefined = factory()->NewCompareOperation(
|
||||
Token::EQ_STRICT, factory()->NewVariableProxy(temp_var),
|
||||
factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition);
|
||||
value = factory()->NewConditional(is_undefined, initializer,
|
||||
factory()->NewVariableProxy(temp_var),
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition);
|
||||
}
|
||||
|
||||
PatternContext old_context = SetAssignmentContextIfNeeded(initializer);
|
||||
@ -429,7 +428,7 @@ void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern,
|
||||
RecurseIntoSubpattern(
|
||||
property->value(),
|
||||
factory()->NewProperty(factory()->NewVariableProxy(temp),
|
||||
property->key(), RelocInfo::kNoPosition));
|
||||
property->key(), kNoSourcePosition));
|
||||
set_context(context);
|
||||
}
|
||||
}
|
||||
@ -447,13 +446,13 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
|
||||
auto temp = *temp_var = CreateTempVar(current_value_);
|
||||
auto iterator = CreateTempVar(parser_->GetIterator(
|
||||
factory()->NewVariableProxy(temp), factory(), RelocInfo::kNoPosition));
|
||||
auto done = CreateTempVar(
|
||||
factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition));
|
||||
factory()->NewVariableProxy(temp), factory(), kNoSourcePosition));
|
||||
auto done =
|
||||
CreateTempVar(factory()->NewBooleanLiteral(false, kNoSourcePosition));
|
||||
auto result = CreateTempVar();
|
||||
auto v = CreateTempVar();
|
||||
auto completion = CreateTempVar();
|
||||
auto nopos = RelocInfo::kNoPosition;
|
||||
auto nopos = kNoSourcePosition;
|
||||
|
||||
// For the purpose of iterator finalization, we temporarily set block_ to a
|
||||
// new block. In the main body of this function, we write to block_ (both
|
||||
@ -487,30 +486,29 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
auto result_done = factory()->NewProperty(
|
||||
factory()->NewVariableProxy(result),
|
||||
factory()->NewStringLiteral(ast_value_factory()->done_string(),
|
||||
RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition),
|
||||
kNoSourcePosition);
|
||||
|
||||
auto assign_undefined = factory()->NewAssignment(
|
||||
Token::ASSIGN, factory()->NewVariableProxy(v),
|
||||
factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition);
|
||||
|
||||
auto assign_value = factory()->NewAssignment(
|
||||
Token::ASSIGN, factory()->NewVariableProxy(v),
|
||||
factory()->NewProperty(
|
||||
factory()->NewVariableProxy(result),
|
||||
factory()->NewStringLiteral(ast_value_factory()->value_string(),
|
||||
RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition),
|
||||
kNoSourcePosition),
|
||||
kNoSourcePosition);
|
||||
|
||||
auto unset_done = factory()->NewAssignment(
|
||||
Token::ASSIGN, factory()->NewVariableProxy(done),
|
||||
factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
factory()->NewBooleanLiteral(false, kNoSourcePosition),
|
||||
kNoSourcePosition);
|
||||
|
||||
auto inner_else =
|
||||
factory()->NewBlock(nullptr, 2, true, RelocInfo::kNoPosition);
|
||||
factory()->NewBlock(nullptr, 2, true, kNoSourcePosition);
|
||||
inner_else->statements()->Add(
|
||||
factory()->NewExpressionStatement(assign_value, nopos), zone());
|
||||
inner_else->statements()->Add(
|
||||
@ -522,7 +520,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
inner_else, nopos);
|
||||
|
||||
auto next_block =
|
||||
factory()->NewBlock(nullptr, 3, true, RelocInfo::kNoPosition);
|
||||
factory()->NewBlock(nullptr, 3, true, kNoSourcePosition);
|
||||
next_block->statements()->Add(
|
||||
factory()->NewExpressionStatement(
|
||||
factory()->NewAssignment(
|
||||
@ -534,17 +532,16 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
factory()->NewExpressionStatement(
|
||||
parser_->BuildIteratorNextResult(
|
||||
factory()->NewVariableProxy(iterator), result,
|
||||
RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition),
|
||||
kNoSourcePosition),
|
||||
kNoSourcePosition),
|
||||
zone());
|
||||
next_block->statements()->Add(inner_if, zone());
|
||||
|
||||
if_not_done = factory()->NewIfStatement(
|
||||
factory()->NewUnaryOperation(Token::NOT,
|
||||
factory()->NewVariableProxy(done),
|
||||
RelocInfo::kNoPosition),
|
||||
next_block, factory()->NewEmptyStatement(RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
factory()->NewUnaryOperation(
|
||||
Token::NOT, factory()->NewVariableProxy(done), kNoSourcePosition),
|
||||
next_block, factory()->NewEmptyStatement(kNoSourcePosition),
|
||||
kNoSourcePosition);
|
||||
}
|
||||
block_->statements()->Add(if_not_done, zone());
|
||||
|
||||
@ -596,7 +593,7 @@ void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node,
|
||||
empty_exprs,
|
||||
// Reuse pattern's literal index - it is unused since there is no
|
||||
// actual literal allocated.
|
||||
node->literal_index(), RelocInfo::kNoPosition));
|
||||
node->literal_index(), kNoSourcePosition));
|
||||
}
|
||||
|
||||
// done = true;
|
||||
@ -702,11 +699,10 @@ void Parser::PatternRewriter::VisitAssignment(Assignment* node) {
|
||||
if (IsInitializerContext()) {
|
||||
Expression* is_undefined = factory()->NewCompareOperation(
|
||||
Token::EQ_STRICT, factory()->NewVariableProxy(temp),
|
||||
factory()->NewUndefinedLiteral(RelocInfo::kNoPosition),
|
||||
RelocInfo::kNoPosition);
|
||||
factory()->NewUndefinedLiteral(kNoSourcePosition), kNoSourcePosition);
|
||||
value = factory()->NewConditional(is_undefined, initializer,
|
||||
factory()->NewVariableProxy(temp),
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition);
|
||||
}
|
||||
|
||||
// Initializer may have been parsed in the wrong scope.
|
||||
@ -728,8 +724,7 @@ void Parser::PatternRewriter::VisitProperty(v8::internal::Property* node) {
|
||||
factory()->NewAssignment(Token::ASSIGN, node, value, node->position());
|
||||
|
||||
block_->statements()->Add(
|
||||
factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition),
|
||||
zone());
|
||||
factory()->NewExpressionStatement(assignment, kNoSourcePosition), zone());
|
||||
}
|
||||
|
||||
|
||||
|
@ -292,7 +292,7 @@ class PreParserExpression {
|
||||
void set_index(int index) {} // For YieldExpressions
|
||||
void set_should_eager_compile() {}
|
||||
|
||||
int position() const { return RelocInfo::kNoPosition; }
|
||||
int position() const { return kNoSourcePosition; }
|
||||
void set_function_token_position(int position) {}
|
||||
|
||||
private:
|
||||
|
@ -51,7 +51,7 @@ class Processor: public AstVisitor {
|
||||
result_assigned_ = true;
|
||||
VariableProxy* result_proxy = factory()->NewVariableProxy(result_);
|
||||
return factory()->NewAssignment(Token::ASSIGN, result_proxy, value,
|
||||
RelocInfo::kNoPosition);
|
||||
kNoSourcePosition);
|
||||
}
|
||||
|
||||
// Inserts '.result = undefined' in front of the given statement.
|
||||
@ -93,13 +93,12 @@ class Processor: public AstVisitor {
|
||||
|
||||
Statement* Processor::AssignUndefinedBefore(Statement* s) {
|
||||
Expression* result_proxy = factory()->NewVariableProxy(result_);
|
||||
Expression* undef = factory()->NewUndefinedLiteral(RelocInfo::kNoPosition);
|
||||
Expression* assignment = factory()->NewAssignment(
|
||||
Token::ASSIGN, result_proxy, undef, RelocInfo::kNoPosition);
|
||||
Block* b = factory()->NewBlock(NULL, 2, false, RelocInfo::kNoPosition);
|
||||
Expression* undef = factory()->NewUndefinedLiteral(kNoSourcePosition);
|
||||
Expression* assignment = factory()->NewAssignment(Token::ASSIGN, result_proxy,
|
||||
undef, kNoSourcePosition);
|
||||
Block* b = factory()->NewBlock(NULL, 2, false, kNoSourcePosition);
|
||||
b->statements()->Add(
|
||||
factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition),
|
||||
zone());
|
||||
factory()->NewExpressionStatement(assignment, kNoSourcePosition), zone());
|
||||
b->statements()->Add(s, zone());
|
||||
return b;
|
||||
}
|
||||
@ -232,15 +231,13 @@ void Processor::VisitTryFinallyStatement(TryFinallyStatement* node) {
|
||||
Expression* backup_proxy = factory()->NewVariableProxy(backup);
|
||||
Expression* result_proxy = factory()->NewVariableProxy(result_);
|
||||
Expression* save = factory()->NewAssignment(
|
||||
Token::ASSIGN, backup_proxy, result_proxy, RelocInfo::kNoPosition);
|
||||
Token::ASSIGN, backup_proxy, result_proxy, kNoSourcePosition);
|
||||
Expression* restore = factory()->NewAssignment(
|
||||
Token::ASSIGN, result_proxy, backup_proxy, RelocInfo::kNoPosition);
|
||||
Token::ASSIGN, result_proxy, backup_proxy, kNoSourcePosition);
|
||||
node->finally_block()->statements()->InsertAt(
|
||||
0, factory()->NewExpressionStatement(save, RelocInfo::kNoPosition),
|
||||
zone());
|
||||
0, factory()->NewExpressionStatement(save, kNoSourcePosition), zone());
|
||||
node->finally_block()->statements()->Add(
|
||||
factory()->NewExpressionStatement(restore, RelocInfo::kNoPosition),
|
||||
zone());
|
||||
factory()->NewExpressionStatement(restore, kNoSourcePosition), zone());
|
||||
}
|
||||
is_set_ = set_after;
|
||||
Visit(node->try_block());
|
||||
@ -355,7 +352,7 @@ bool Rewriter::Rewrite(ParseInfo* info) {
|
||||
if (processor.HasStackOverflow()) return false;
|
||||
|
||||
if (processor.result_assigned()) {
|
||||
int pos = RelocInfo::kNoPosition;
|
||||
int pos = kNoSourcePosition;
|
||||
VariableProxy* result_proxy =
|
||||
processor.factory()->NewVariableProxy(result, pos);
|
||||
Statement* result_statement =
|
||||
@ -383,8 +380,7 @@ bool Rewriter::Rewrite(Parser* parser, DoExpression* expr,
|
||||
|
||||
if (!processor.result_assigned()) {
|
||||
AstNodeFactory* node_factory = processor.factory();
|
||||
Expression* undef =
|
||||
node_factory->NewUndefinedLiteral(RelocInfo::kNoPosition);
|
||||
Expression* undef = node_factory->NewUndefinedLiteral(kNoSourcePosition);
|
||||
Statement* completion = node_factory->NewExpressionStatement(
|
||||
processor.SetResult(undef), expr->position());
|
||||
body->Add(completion, factory->zone());
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "src/debug/debug-scopes.h"
|
||||
#include "src/debug/debug.h"
|
||||
#include "src/frames-inl.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/interpreter/bytecodes.h"
|
||||
#include "src/interpreter/interpreter.h"
|
||||
#include "src/isolate-inl.h"
|
||||
@ -563,7 +564,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
|
||||
details->set(kFrameDetailsLocalCountIndex, Smi::FromInt(0));
|
||||
|
||||
// Add the source position.
|
||||
if (position != RelocInfo::kNoPosition) {
|
||||
if (position != kNoSourcePosition) {
|
||||
details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position));
|
||||
}
|
||||
|
||||
@ -703,7 +704,7 @@ RUNTIME_FUNCTION(Runtime_GetFrameDetails) {
|
||||
details->set(kFrameDetailsLocalCountIndex, Smi::FromInt(local_count));
|
||||
|
||||
// Add the source position.
|
||||
if (position != RelocInfo::kNoPosition) {
|
||||
if (position != kNoSourcePosition) {
|
||||
details->set(kFrameDetailsSourcePositionIndex, Smi::FromInt(position));
|
||||
} else {
|
||||
details->set(kFrameDetailsSourcePositionIndex, heap->undefined_value());
|
||||
|
@ -7,8 +7,8 @@
|
||||
|
||||
#include <ostream>
|
||||
|
||||
#include "src/assembler.h"
|
||||
#include "src/flags.h"
|
||||
#include "src/globals.h"
|
||||
#include "src/utils.h"
|
||||
|
||||
namespace v8 {
|
||||
@ -49,8 +49,7 @@ class SourcePosition {
|
||||
uint32_t raw() const { return value_; }
|
||||
|
||||
private:
|
||||
static const uint32_t kNoPosition =
|
||||
static_cast<uint32_t>(RelocInfo::kNoPosition);
|
||||
static const uint32_t kNoPosition = static_cast<uint32_t>(kNoSourcePosition);
|
||||
typedef BitField<uint32_t, 0, 9> InliningIdField;
|
||||
|
||||
// Offset from the start of the inlined function.
|
||||
|
@ -19,7 +19,7 @@ namespace internal {
|
||||
#define FAIL(node, msg) \
|
||||
do { \
|
||||
valid_ = false; \
|
||||
int line = node->position() == RelocInfo::kNoPosition \
|
||||
int line = node->position() == kNoSourcePosition \
|
||||
? -1 \
|
||||
: script_->GetLineNumber(node->position()); \
|
||||
base::OS::SNPrintF(error_message_, sizeof(error_message_), \
|
||||
@ -27,7 +27,6 @@ namespace internal {
|
||||
return; \
|
||||
} while (false)
|
||||
|
||||
|
||||
#define RECURSE(call) \
|
||||
do { \
|
||||
DCHECK(!HasStackOverflow()); \
|
||||
|
@ -42,7 +42,7 @@ TEST(List) {
|
||||
Zone zone(&allocator);
|
||||
AstValueFactory value_factory(&zone, 0);
|
||||
AstNodeFactory factory(&value_factory);
|
||||
AstNode* node = factory.NewEmptyStatement(RelocInfo::kNoPosition);
|
||||
AstNode* node = factory.NewEmptyStatement(kNoSourcePosition);
|
||||
list->Add(node);
|
||||
CHECK_EQ(1, list->length());
|
||||
CHECK_EQ(node, list->at(0));
|
||||
|
Loading…
Reference in New Issue
Block a user