Revert of Correctly annotate eval origin. (patchset #4 id:60001 of https://codereview.chromium.org/1854713002/ )
Reason for revert: [Sheriff] Crashes a layout test: https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/5855 Original issue's description: > Correctly annotate eval origin. > > There were a couple of issues with it: > - interpreter is not supported > - the source position was just accidentally correct for full-codegen > - the eval origin could have been cached > > Also fixes a few other places to use AbstractCode. > > R=mstarzinger@chromium.org > > Committed: https://crrev.com/2f3a171adc9e620c2235bf0562145b9d4eaba66d > Cr-Commit-Position: refs/heads/master@{#35257} TBR=mstarzinger@chromium.org,yangguo@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Review URL: https://codereview.chromium.org/1858773004 Cr-Commit-Position: refs/heads/master@{#35260}
This commit is contained in:
parent
4142bc6bc1
commit
cf951dfb37
@ -661,8 +661,11 @@ void Accessors::ScriptEvalFromScriptPositionGetter(
|
||||
Script::cast(Handle<JSValue>::cast(object)->value()), isolate);
|
||||
Handle<Object> result = isolate->factory()->undefined_value();
|
||||
if (script->compilation_type() == Script::COMPILATION_TYPE_EVAL) {
|
||||
result =
|
||||
Handle<Object>(Smi::FromInt(script->eval_from_position()), isolate);
|
||||
Handle<Code> code(SharedFunctionInfo::cast(
|
||||
script->eval_from_shared())->code());
|
||||
result = Handle<Object>(Smi::FromInt(code->SourcePosition(
|
||||
script->eval_from_instructions_offset())),
|
||||
isolate);
|
||||
}
|
||||
info.GetReturnValue().Set(Utils::ToLocal(result));
|
||||
}
|
||||
|
12
src/api.cc
12
src/api.cc
@ -2032,7 +2032,6 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
|
||||
}
|
||||
|
||||
i::Handle<i::Object> name_obj;
|
||||
int eval_position = 0;
|
||||
int line_offset = 0;
|
||||
int column_offset = 0;
|
||||
if (!source->resource_name.IsEmpty()) {
|
||||
@ -2045,12 +2044,11 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
|
||||
column_offset = static_cast<int>(source->resource_column_offset->Value());
|
||||
}
|
||||
i::Handle<i::JSFunction> fun;
|
||||
has_pending_exception =
|
||||
!i::Compiler::GetFunctionFromEval(
|
||||
source_string, outer_info, context, i::SLOPPY,
|
||||
i::ONLY_SINGLE_FUNCTION_LITERAL, eval_position, line_offset,
|
||||
column_offset - scope_position, name_obj, source->resource_options)
|
||||
.ToHandle(&fun);
|
||||
has_pending_exception = !i::Compiler::GetFunctionFromEval(
|
||||
source_string, outer_info, context, i::SLOPPY,
|
||||
i::ONLY_SINGLE_FUNCTION_LITERAL, line_offset,
|
||||
column_offset - scope_position, name_obj,
|
||||
source->resource_options).ToHandle(&fun);
|
||||
if (has_pending_exception) {
|
||||
isolate->ReportPendingMessages();
|
||||
}
|
||||
|
@ -2055,12 +2055,11 @@ MaybeHandle<JSFunction> CompileString(Handle<Context> context,
|
||||
}
|
||||
|
||||
// Compile source string in the native context.
|
||||
StackTraceFrameIterator it(isolate);
|
||||
FrameSummary summary = FrameSummary::GetFirst(it.frame());
|
||||
Handle<SharedFunctionInfo> outer_info(summary.function()->shared());
|
||||
int pos = summary.abstract_code()->SourcePosition(summary.code_offset());
|
||||
Handle<SharedFunctionInfo> outer_info(native_context->closure()->shared(),
|
||||
isolate);
|
||||
return Compiler::GetFunctionFromEval(source, outer_info, native_context,
|
||||
SLOPPY, restriction, pos);
|
||||
SLOPPY, restriction,
|
||||
RelocInfo::kNoPosition);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
@ -1509,9 +1509,8 @@ void Compiler::CompileForLiveEdit(Handle<Script> script) {
|
||||
MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context, LanguageMode language_mode,
|
||||
ParseRestriction restriction, int eval_position, int line_offset,
|
||||
int column_offset, Handle<Object> script_name,
|
||||
ScriptOriginOptions options) {
|
||||
ParseRestriction restriction, int line_offset, int column_offset,
|
||||
Handle<Object> script_name, ScriptOriginOptions options) {
|
||||
Isolate* isolate = source->GetIsolate();
|
||||
int source_length = source->length();
|
||||
isolate->counters()->total_eval_size()->Increment(source_length);
|
||||
@ -1520,7 +1519,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
CompilationCache* compilation_cache = isolate->compilation_cache();
|
||||
MaybeHandle<SharedFunctionInfo> maybe_shared_info =
|
||||
compilation_cache->LookupEval(source, outer_info, context, language_mode,
|
||||
eval_position);
|
||||
line_offset);
|
||||
Handle<SharedFunctionInfo> shared_info;
|
||||
|
||||
Handle<Script> script;
|
||||
@ -1532,10 +1531,6 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
script->set_column_offset(column_offset);
|
||||
}
|
||||
script->set_origin_options(options);
|
||||
script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
|
||||
script->set_eval_from_shared(*outer_info);
|
||||
script->set_eval_from_position(eval_position);
|
||||
|
||||
Zone zone(isolate->allocator());
|
||||
ParseInfo parse_info(&zone, script);
|
||||
CompilationInfo info(&parse_info);
|
||||
@ -1545,6 +1540,8 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
parse_info.set_parse_restriction(restriction);
|
||||
parse_info.set_context(context);
|
||||
|
||||
Debug::RecordEvalCaller(script);
|
||||
|
||||
shared_info = CompileToplevel(&info);
|
||||
|
||||
if (shared_info.is_null()) {
|
||||
@ -1560,7 +1557,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
|
||||
DCHECK(is_sloppy(language_mode) ||
|
||||
is_strict(shared_info->language_mode()));
|
||||
compilation_cache->PutEval(source, outer_info, context, shared_info,
|
||||
eval_position);
|
||||
line_offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -77,8 +77,8 @@ class Compiler : public AllStatic {
|
||||
MUST_USE_RESULT static MaybeHandle<JSFunction> GetFunctionFromEval(
|
||||
Handle<String> source, Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context, LanguageMode language_mode,
|
||||
ParseRestriction restriction, int eval_position, int line_offset = 0,
|
||||
int column_offset = 0, Handle<Object> script_name = Handle<Object>(),
|
||||
ParseRestriction restriction, int line_offset, int column_offset = 0,
|
||||
Handle<Object> script_name = Handle<Object>(),
|
||||
ScriptOriginOptions options = ScriptOriginOptions());
|
||||
|
||||
// Create a shared function info object for a String source within a context.
|
||||
|
@ -2456,7 +2456,7 @@ void AstGraphBuilder::VisitCall(Call* expr) {
|
||||
// provide a fully resolved callee to patch into the environment.
|
||||
Node* function = GetFunctionClosure();
|
||||
Node* language = jsgraph()->Constant(language_mode());
|
||||
Node* position = jsgraph()->Constant(expr->position());
|
||||
Node* position = jsgraph()->Constant(current_scope()->start_position());
|
||||
const Operator* op =
|
||||
javascript()->CallRuntime(Runtime::kResolvePossiblyDirectEval);
|
||||
Node* new_callee =
|
||||
|
@ -95,11 +95,11 @@ 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, 0),
|
||||
Object);
|
||||
ASSIGN_RETURN_ON_EXCEPTION(isolate, eval_fun,
|
||||
Compiler::GetFunctionFromEval(
|
||||
source, outer_info, context, SLOPPY,
|
||||
NO_PARSE_RESTRICTION, RelocInfo::kNoPosition),
|
||||
Object);
|
||||
|
||||
Handle<Object> result;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
|
@ -72,7 +72,8 @@ int FrameInspector::GetSourcePosition() {
|
||||
return deoptimized_frame_->GetSourcePosition();
|
||||
} else if (is_interpreted_) {
|
||||
InterpretedFrame* frame = reinterpret_cast<InterpretedFrame*>(frame_);
|
||||
BytecodeArray* bytecode_array = frame->GetBytecodeArray();
|
||||
BytecodeArray* bytecode_array =
|
||||
frame->function()->shared()->bytecode_array();
|
||||
return bytecode_array->SourcePosition(frame->GetBytecodeOffset());
|
||||
} else {
|
||||
Code* code = frame_->LookupCode();
|
||||
|
@ -260,6 +260,12 @@ BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info,
|
||||
return it->GetBreakLocation();
|
||||
}
|
||||
|
||||
FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) {
|
||||
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
|
||||
frame->Summarize(&frames);
|
||||
return frames.first();
|
||||
}
|
||||
|
||||
int CallOffsetFromCodeOffset(int code_offset, bool is_interpreted) {
|
||||
// Code offset points to the instruction after the call. Subtract 1 to
|
||||
// exclude that instruction from the search. For bytecode, the code offset
|
||||
@ -269,7 +275,7 @@ int CallOffsetFromCodeOffset(int code_offset, bool is_interpreted) {
|
||||
|
||||
BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
|
||||
JavaScriptFrame* frame) {
|
||||
FrameSummary summary = FrameSummary::GetFirst(frame);
|
||||
FrameSummary summary = GetFirstFrameSummary(frame);
|
||||
int call_offset =
|
||||
CallOffsetFromCodeOffset(summary.code_offset(), frame->is_interpreted());
|
||||
return FromCodeOffset(debug_info, call_offset);
|
||||
@ -625,7 +631,7 @@ void Debug::Break(JavaScriptFrame* frame) {
|
||||
step_break = location.IsTailCall();
|
||||
// Fall through.
|
||||
case StepIn: {
|
||||
FrameSummary summary = FrameSummary::GetFirst(frame);
|
||||
FrameSummary summary = GetFirstFrameSummary(frame);
|
||||
int offset = summary.code_offset();
|
||||
step_break = step_break || location.IsReturn() ||
|
||||
(current_fp != last_fp) ||
|
||||
@ -1005,7 +1011,7 @@ void Debug::PrepareStep(StepAction step_action) {
|
||||
}
|
||||
|
||||
// Get the debug info (create it if it does not exist).
|
||||
FrameSummary summary = FrameSummary::GetFirst(frame);
|
||||
FrameSummary summary = GetFirstFrameSummary(frame);
|
||||
Handle<JSFunction> function(summary.function());
|
||||
Handle<SharedFunctionInfo> shared(function->shared());
|
||||
if (!EnsureDebugInfo(shared, function)) {
|
||||
@ -1016,7 +1022,7 @@ void Debug::PrepareStep(StepAction step_action) {
|
||||
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
|
||||
// Refresh frame summary if the code has been recompiled for debugging.
|
||||
if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) {
|
||||
summary = FrameSummary::GetFirst(frame);
|
||||
summary = GetFirstFrameSummary(frame);
|
||||
}
|
||||
|
||||
int call_offset =
|
||||
@ -1598,7 +1604,7 @@ bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) {
|
||||
if (!shared->HasDebugInfo()) return false;
|
||||
|
||||
DCHECK(!frame->is_optimized());
|
||||
FrameSummary summary = FrameSummary::GetFirst(frame);
|
||||
FrameSummary summary = GetFirstFrameSummary(frame);
|
||||
|
||||
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
|
||||
BreakLocation location =
|
||||
@ -1650,6 +1656,21 @@ Handle<FixedArray> Debug::GetLoadedScripts() {
|
||||
}
|
||||
|
||||
|
||||
void Debug::RecordEvalCaller(Handle<Script> script) {
|
||||
script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
|
||||
// For eval scripts add information on the function from which eval was
|
||||
// called.
|
||||
StackTraceFrameIterator it(script->GetIsolate());
|
||||
if (!it.done()) {
|
||||
script->set_eval_from_shared(it.frame()->function()->shared());
|
||||
Code* code = it.frame()->LookupCode();
|
||||
int offset = static_cast<int>(
|
||||
it.frame()->pc() - code->instruction_start());
|
||||
script->set_eval_from_instructions_offset(offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> Debug::MakeExecutionState() {
|
||||
// Create the execution state object.
|
||||
Handle<Object> argv[] = { isolate_->factory()->NewNumberFromInt(break_id()) };
|
||||
@ -2266,7 +2287,7 @@ void Debug::PrintBreakLocation() {
|
||||
JavaScriptFrameIterator iterator(isolate_);
|
||||
if (iterator.done()) return;
|
||||
JavaScriptFrame* frame = iterator.frame();
|
||||
FrameSummary summary = FrameSummary::GetFirst(frame);
|
||||
FrameSummary summary = GetFirstFrameSummary(frame);
|
||||
int source_position =
|
||||
summary.abstract_code()->SourcePosition(summary.code_offset());
|
||||
Handle<Object> script_obj(summary.function()->shared()->script(), isolate_);
|
||||
|
@ -499,6 +499,9 @@ class Debug {
|
||||
static int ArchiveSpacePerThread();
|
||||
void FreeThreadResources() { }
|
||||
|
||||
// Record function from which eval was called.
|
||||
static void RecordEvalCaller(Handle<Script> script);
|
||||
|
||||
bool CheckExecutionState(int id) {
|
||||
return is_active() && !debug_context().is_null() && break_id() != 0 &&
|
||||
break_id() == id;
|
||||
|
@ -1374,7 +1374,8 @@ static Handle<Script> CreateScriptCopy(Handle<Script> original) {
|
||||
copy->set_type(original->type());
|
||||
copy->set_context_data(original->context_data());
|
||||
copy->set_eval_from_shared(original->eval_from_shared());
|
||||
copy->set_eval_from_position(original->eval_from_position());
|
||||
copy->set_eval_from_instructions_offset(
|
||||
original->eval_from_instructions_offset());
|
||||
|
||||
// Copy all the flags, but clear compilation state.
|
||||
copy->set_flags(original->flags());
|
||||
|
@ -893,7 +893,7 @@ Handle<Script> Factory::NewScript(Handle<String> source) {
|
||||
script->set_wrapper(heap->undefined_value());
|
||||
script->set_line_ends(heap->undefined_value());
|
||||
script->set_eval_from_shared(heap->undefined_value());
|
||||
script->set_eval_from_position(0);
|
||||
script->set_eval_from_instructions_offset(0);
|
||||
script->set_shared_function_infos(Smi::FromInt(0));
|
||||
script->set_flags(0);
|
||||
|
||||
|
@ -976,12 +976,6 @@ FrameSummary::FrameSummary(Object* receiver, JSFunction* function,
|
||||
CannotDeoptFromAsmCode(Code::cast(abstract_code), function));
|
||||
}
|
||||
|
||||
FrameSummary FrameSummary::GetFirst(JavaScriptFrame* frame) {
|
||||
List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
|
||||
frame->Summarize(&frames);
|
||||
return frames.first();
|
||||
}
|
||||
|
||||
void FrameSummary::Print() {
|
||||
PrintF("receiver: ");
|
||||
receiver_->ShortPrint();
|
||||
@ -1234,15 +1228,15 @@ void InterpretedFrame::PatchBytecodeOffset(int new_offset) {
|
||||
SetExpression(index, Smi::FromInt(raw_offset));
|
||||
}
|
||||
|
||||
BytecodeArray* InterpretedFrame::GetBytecodeArray() const {
|
||||
Object* InterpretedFrame::GetBytecodeArray() const {
|
||||
const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex;
|
||||
DCHECK_EQ(
|
||||
InterpreterFrameConstants::kBytecodeArrayFromFp,
|
||||
InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
|
||||
return BytecodeArray::cast(GetExpression(index));
|
||||
return GetExpression(index);
|
||||
}
|
||||
|
||||
void InterpretedFrame::PatchBytecodeArray(BytecodeArray* bytecode_array) {
|
||||
void InterpretedFrame::PatchBytecodeArray(Object* bytecode_array) {
|
||||
const int index = InterpreterFrameConstants::kBytecodeArrayExpressionIndex;
|
||||
DCHECK_EQ(
|
||||
InterpreterFrameConstants::kBytecodeArrayFromFp,
|
||||
|
@ -701,7 +701,6 @@ class StandardFrame: public StackFrame {
|
||||
friend class SafeStackFrameIterator;
|
||||
};
|
||||
|
||||
class JavaScriptFrame;
|
||||
|
||||
class FrameSummary BASE_EMBEDDED {
|
||||
public:
|
||||
@ -709,8 +708,6 @@ class FrameSummary BASE_EMBEDDED {
|
||||
AbstractCode* abstract_code, int code_offset,
|
||||
bool is_constructor);
|
||||
|
||||
static FrameSummary GetFirst(JavaScriptFrame* frame);
|
||||
|
||||
Handle<Object> receiver() { return receiver_; }
|
||||
Handle<JSFunction> function() { return function_; }
|
||||
Handle<AbstractCode> abstract_code() { return abstract_code_; }
|
||||
@ -896,11 +893,11 @@ class InterpretedFrame : public JavaScriptFrame {
|
||||
void PatchBytecodeOffset(int new_offset);
|
||||
|
||||
// Returns the frame's current bytecode array.
|
||||
BytecodeArray* GetBytecodeArray() const;
|
||||
Object* GetBytecodeArray() const;
|
||||
|
||||
// Updates the frame's BytecodeArray with |bytecode_array|. Used by the
|
||||
// debugger to swap execution onto a BytecodeArray patched with breakpoints.
|
||||
void PatchBytecodeArray(BytecodeArray* bytecode_array);
|
||||
void PatchBytecodeArray(Object* bytecode_array);
|
||||
|
||||
// Access to the interpreter register file for this frame.
|
||||
Object* GetInterpreterRegister(int register_index) const;
|
||||
|
@ -2663,8 +2663,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, r0);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// r4: copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ ldr(r4, MemOperand(sp, arg_count * kPointerSize));
|
||||
@ -2678,8 +2678,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// r2: language mode.
|
||||
__ mov(r2, Operand(Smi::FromInt(language_mode())));
|
||||
|
||||
// r1: the source position of the eval call.
|
||||
__ mov(r1, Operand(Smi::FromInt(expr->position())));
|
||||
// r1: the start position of the scope the calls resides in.
|
||||
__ mov(r1, Operand(Smi::FromInt(scope()->start_position())));
|
||||
|
||||
// Do the runtime call.
|
||||
__ Push(r4, r3, r2, r1);
|
||||
@ -2731,7 +2731,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call
|
||||
// Runtime_ResolvePossiblyDirectEval to resolve the function we need
|
||||
// RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need
|
||||
// to call. Then we call the resolved function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
int arg_count = args->length();
|
||||
@ -2747,7 +2747,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
__ push(r1);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
|
@ -2461,8 +2461,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, x0);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
ASM_LOCATION("FullCodeGenerator::EmitResolvePossiblyDirectEval");
|
||||
// Prepare to push a copy of the first argument or undefined if it doesn't
|
||||
// exist.
|
||||
@ -2476,8 +2476,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
|
||||
// Prepare to push the language mode.
|
||||
__ Mov(x11, Smi::FromInt(language_mode()));
|
||||
// Prepare to push the source position of the eval call.
|
||||
__ Mov(x12, Smi::FromInt(expr->position()));
|
||||
// Prepare to push the start position of the scope the calls resides in.
|
||||
__ Mov(x12, Smi::FromInt(scope()->start_position()));
|
||||
|
||||
// Push.
|
||||
__ Push(x9, x10, x11, x12);
|
||||
@ -2530,7 +2530,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
ASM_LOCATION("FullCodeGenerator::EmitPossiblyEvalCall");
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2547,7 +2547,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ Peek(x10, (arg_count + 1) * kPointerSize);
|
||||
__ Push(x10);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ Poke(x0, (arg_count + 1) * kPointerSize);
|
||||
|
@ -560,7 +560,7 @@ class FullCodeGenerator: public AstVisitor {
|
||||
bool NeedsHoleCheckForLoad(VariableProxy* proxy);
|
||||
|
||||
// Expects the arguments and the function already pushed.
|
||||
void EmitResolvePossiblyDirectEval(Call* expr);
|
||||
void EmitResolvePossiblyDirectEval(int arg_count);
|
||||
|
||||
// Platform-specific support for allocating a new closure based on
|
||||
// the given function info.
|
||||
|
@ -2550,8 +2550,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, eax);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// Push copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ push(Operand(esp, arg_count * kPointerSize));
|
||||
@ -2565,8 +2565,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// Push the language mode.
|
||||
__ push(Immediate(Smi::FromInt(language_mode())));
|
||||
|
||||
// Push the source position of the eval call.
|
||||
__ push(Immediate(Smi::FromInt(expr->position())));
|
||||
// Push the start position of the scope the calls resides in.
|
||||
__ push(Immediate(Smi::FromInt(scope()->start_position())));
|
||||
|
||||
// Do the runtime call.
|
||||
__ CallRuntime(Runtime::kResolvePossiblyDirectEval);
|
||||
@ -2614,7 +2614,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2630,7 +2630,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// Push a copy of the function (found below the arguments) and
|
||||
// resolve eval.
|
||||
__ push(Operand(esp, (arg_count + 1) * kPointerSize));
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
|
||||
|
@ -2660,8 +2660,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, v0);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// t3: copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ lw(t3, MemOperand(sp, arg_count * kPointerSize));
|
||||
@ -2675,8 +2675,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// t1: the language mode.
|
||||
__ li(t1, Operand(Smi::FromInt(language_mode())));
|
||||
|
||||
// t0: the source position of the eval call.
|
||||
__ li(t0, Operand(Smi::FromInt(expr->position())));
|
||||
// t0: the start position of the scope the calls resides in.
|
||||
__ li(t0, Operand(Smi::FromInt(scope()->start_position())));
|
||||
|
||||
// Do the runtime call.
|
||||
__ Push(t3, t2, t1, t0);
|
||||
@ -2728,7 +2728,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2744,7 +2744,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ lw(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
__ push(a1);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ sw(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
|
@ -2661,8 +2661,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, v0);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// a6: copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ ld(a6, MemOperand(sp, arg_count * kPointerSize));
|
||||
@ -2676,8 +2676,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// a4: the language mode.
|
||||
__ li(a4, Operand(Smi::FromInt(language_mode())));
|
||||
|
||||
// a1: the source position of the eval call.
|
||||
__ li(a1, Operand(Smi::FromInt(expr->position())));
|
||||
// a1: the start position of the scope the calls resides in.
|
||||
__ li(a1, Operand(Smi::FromInt(scope()->start_position())));
|
||||
|
||||
// Do the runtime call.
|
||||
__ Push(a6, a5, a4, a1);
|
||||
@ -2729,7 +2729,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2745,7 +2745,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ ld(a1, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
__ push(a1);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ sd(v0, MemOperand(sp, (arg_count + 1) * kPointerSize));
|
||||
|
@ -2664,8 +2664,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, r3);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// r7: copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ LoadP(r7, MemOperand(sp, arg_count * kPointerSize), r0);
|
||||
@ -2679,8 +2679,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// r5: language mode.
|
||||
__ LoadSmiLiteral(r5, Smi::FromInt(language_mode()));
|
||||
|
||||
// r4: the source position of the eval call.
|
||||
__ LoadSmiLiteral(r4, Smi::FromInt(expr->position()));
|
||||
// r4: the start position of the scope the calls resides in.
|
||||
__ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position()));
|
||||
|
||||
// Do the runtime call.
|
||||
__ Push(r7, r6, r5, r4);
|
||||
@ -2731,7 +2731,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2748,7 +2748,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ LoadP(r4, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
||||
__ push(r4);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ StoreP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
||||
|
@ -2599,8 +2599,7 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, r2);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// r6: copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ LoadP(r6, MemOperand(sp, arg_count * kPointerSize), r0);
|
||||
@ -2614,8 +2613,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// r4: language mode.
|
||||
__ LoadSmiLiteral(r4, Smi::FromInt(language_mode()));
|
||||
|
||||
// r3: the source position of the eval call.
|
||||
__ LoadSmiLiteral(r3, Smi::FromInt(expr->position()));
|
||||
// r3: the start position of the scope the calls resides in.
|
||||
__ LoadSmiLiteral(r3, Smi::FromInt(scope()->start_position()));
|
||||
|
||||
// Do the runtime call.
|
||||
__ Push(r6, r5, r4, r3);
|
||||
@ -2664,7 +2663,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2681,7 +2680,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// resolve eval.
|
||||
__ LoadP(r3, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
||||
__ push(r3);
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ StoreP(r2, MemOperand(sp, (arg_count + 1) * kPointerSize), r0);
|
||||
|
@ -2540,8 +2540,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, rax);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// Push copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ Push(Operand(rsp, arg_count * kPointerSize));
|
||||
@ -2555,8 +2555,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// Push the language mode.
|
||||
__ Push(Smi::FromInt(language_mode()));
|
||||
|
||||
// Push the source position of the eval call.
|
||||
__ Push(Smi::FromInt(expr->position()));
|
||||
// Push the start position of the scope the calls resides in.
|
||||
__ Push(Smi::FromInt(scope()->start_position()));
|
||||
|
||||
// Do the runtime call.
|
||||
__ CallRuntime(Runtime::kResolvePossiblyDirectEval);
|
||||
@ -2605,7 +2605,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2620,7 +2620,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// Push a copy of the function (found below the arguments) and resolve
|
||||
// eval.
|
||||
__ Push(Operand(rsp, (arg_count + 1) * kPointerSize));
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the callee.
|
||||
__ movp(Operand(rsp, (arg_count + 1) * kPointerSize), rax);
|
||||
|
@ -2542,8 +2542,8 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
|
||||
context()->DropAndPlug(1, eax);
|
||||
}
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
int arg_count = expr->arguments()->length();
|
||||
|
||||
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
||||
// Push copy of the first argument or undefined if it doesn't exist.
|
||||
if (arg_count > 0) {
|
||||
__ push(Operand(esp, arg_count * kPointerSize));
|
||||
@ -2557,8 +2557,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(Call* expr) {
|
||||
// Push the language mode.
|
||||
__ push(Immediate(Smi::FromInt(language_mode())));
|
||||
|
||||
// Push the source position of the eval call.
|
||||
__ push(Immediate(Smi::FromInt(expr->position())));
|
||||
// Push the start position of the scope the calls resides in.
|
||||
__ push(Immediate(Smi::FromInt(scope()->start_position())));
|
||||
|
||||
// Do the runtime call.
|
||||
__ CallRuntime(Runtime::kResolvePossiblyDirectEval);
|
||||
@ -2606,7 +2606,7 @@ void FullCodeGenerator::PushCalleeAndWithBaseObject(Call* expr) {
|
||||
|
||||
|
||||
void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// In a call to eval, we first call Runtime_ResolvePossiblyDirectEval
|
||||
// In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
|
||||
// to resolve the function we need to call. Then we call the resolved
|
||||
// function using the given arguments.
|
||||
ZoneList<Expression*>* args = expr->arguments();
|
||||
@ -2622,7 +2622,7 @@ void FullCodeGenerator::EmitPossiblyEvalCall(Call* expr) {
|
||||
// Push a copy of the function (found below the arguments) and
|
||||
// resolve eval.
|
||||
__ push(Operand(esp, (arg_count + 1) * kPointerSize));
|
||||
EmitResolvePossiblyDirectEval(expr);
|
||||
EmitResolvePossiblyDirectEval(arg_count);
|
||||
|
||||
// Touch up the stack with the resolved function.
|
||||
__ mov(Operand(esp, (arg_count + 1) * kPointerSize), eax);
|
||||
|
@ -763,10 +763,10 @@ void Heap::PreprocessStackTraces() {
|
||||
// If GC happens while adding a stack trace to the weak fixed array,
|
||||
// which has been copied into a larger backing store, we may run into
|
||||
// a stack trace that has already been preprocessed. Guard against this.
|
||||
if (!maybe_code->IsAbstractCode()) break;
|
||||
AbstractCode* abstract_code = AbstractCode::cast(maybe_code);
|
||||
if (!maybe_code->IsCode()) break;
|
||||
Code* code = Code::cast(maybe_code);
|
||||
int offset = Smi::cast(elements->get(j + 3))->value();
|
||||
int pos = abstract_code->SourcePosition(offset);
|
||||
int pos = code->SourcePosition(offset);
|
||||
elements->set(j + 2, Smi::FromInt(pos));
|
||||
}
|
||||
}
|
||||
|
@ -2468,7 +2468,8 @@ void BytecodeGenerator::VisitCall(Call* expr) {
|
||||
.MoveRegister(Register::function_closure(), function)
|
||||
.LoadLiteral(Smi::FromInt(language_mode()))
|
||||
.StoreAccumulatorInRegister(language)
|
||||
.LoadLiteral(Smi::FromInt(expr->position()))
|
||||
.LoadLiteral(
|
||||
Smi::FromInt(execution_context()->scope()->start_position()))
|
||||
.StoreAccumulatorInRegister(position);
|
||||
|
||||
// Call ResolvePossiblyDirectEval and modify the callee.
|
||||
|
@ -1319,16 +1319,9 @@ void Isolate::PrintCurrentStackTrace(FILE* out) {
|
||||
HandleScope scope(this);
|
||||
// Find code position if recorded in relocation info.
|
||||
JavaScriptFrame* frame = it.frame();
|
||||
int pos = RelocInfo::kNoPosition;
|
||||
if (frame->is_interpreted()) {
|
||||
InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame);
|
||||
BytecodeArray* bytecode_array = iframe->GetBytecodeArray();
|
||||
pos = bytecode_array->SourcePosition(iframe->GetBytecodeOffset());
|
||||
} else if (!frame->is_optimized()) {
|
||||
Code* code = frame->LookupCode();
|
||||
int offset = static_cast<int>(frame->pc() - code->instruction_start());
|
||||
pos = frame->LookupCode()->SourcePosition(offset);
|
||||
}
|
||||
Code* code = frame->LookupCode();
|
||||
int offset = static_cast<int>(frame->pc() - code->instruction_start());
|
||||
int pos = frame->LookupCode()->SourcePosition(offset);
|
||||
Handle<Object> pos_obj(Smi::FromInt(pos), this);
|
||||
// Fetch function and receiver.
|
||||
Handle<JSFunction> fun(frame->function());
|
||||
|
@ -5534,7 +5534,8 @@ ACCESSORS(Script, wrapper, HeapObject, kWrapperOffset)
|
||||
SMI_ACCESSORS(Script, type, kTypeOffset)
|
||||
ACCESSORS(Script, line_ends, Object, kLineEndsOffset)
|
||||
ACCESSORS(Script, eval_from_shared, Object, kEvalFromSharedOffset)
|
||||
SMI_ACCESSORS(Script, eval_from_position, kEvalFromPositionOffset)
|
||||
SMI_ACCESSORS(Script, eval_from_instructions_offset,
|
||||
kEvalFrominstructionsOffsetOffset)
|
||||
ACCESSORS(Script, shared_function_infos, Object, kSharedFunctionInfosOffset)
|
||||
SMI_ACCESSORS(Script, flags, kFlagsOffset)
|
||||
ACCESSORS(Script, source_url, Object, kSourceUrlOffset)
|
||||
|
@ -1140,7 +1140,8 @@ void Script::ScriptPrint(std::ostream& os) { // NOLINT
|
||||
os << "\n - compilation type: " << compilation_type();
|
||||
os << "\n - line ends: " << Brief(line_ends());
|
||||
os << "\n - eval from shared: " << Brief(eval_from_shared());
|
||||
os << "\n - eval from position: " << eval_from_position();
|
||||
os << "\n - eval from instructions offset: "
|
||||
<< eval_from_instructions_offset();
|
||||
os << "\n - shared function infos: " << Brief(shared_function_infos());
|
||||
os << "\n";
|
||||
}
|
||||
|
@ -6481,9 +6481,9 @@ class Script: public Struct {
|
||||
// function from which eval was called.
|
||||
DECL_ACCESSORS(eval_from_shared, Object)
|
||||
|
||||
// [eval_from_position]: the source position in the code for the
|
||||
// function from which eval was called.
|
||||
DECL_INT_ACCESSORS(eval_from_position)
|
||||
// [eval_from_instructions_offset]: the instruction offset in the code for the
|
||||
// function from which eval was called where eval was called.
|
||||
DECL_INT_ACCESSORS(eval_from_instructions_offset)
|
||||
|
||||
// [shared_function_infos]: weak fixed array containing all shared
|
||||
// function infos created from this script.
|
||||
@ -6570,10 +6570,10 @@ class Script: public Struct {
|
||||
static const int kLineEndsOffset = kTypeOffset + kPointerSize;
|
||||
static const int kIdOffset = kLineEndsOffset + kPointerSize;
|
||||
static const int kEvalFromSharedOffset = kIdOffset + kPointerSize;
|
||||
static const int kEvalFromPositionOffset =
|
||||
static const int kEvalFrominstructionsOffsetOffset =
|
||||
kEvalFromSharedOffset + kPointerSize;
|
||||
static const int kSharedFunctionInfosOffset =
|
||||
kEvalFromPositionOffset + kPointerSize;
|
||||
kEvalFrominstructionsOffsetOffset + kPointerSize;
|
||||
static const int kFlagsOffset = kSharedFunctionInfosOffset + kPointerSize;
|
||||
static const int kSourceUrlOffset = kFlagsOffset + kPointerSize;
|
||||
static const int kSourceMappingUrlOffset = kSourceUrlOffset + kPointerSize;
|
||||
|
@ -305,10 +305,11 @@ bool CodeGenerationFromStringsAllowed(Isolate* isolate,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
LanguageMode language_mode,
|
||||
int eval_position) {
|
||||
int scope_position) {
|
||||
Handle<Context> context = Handle<Context>(isolate->context());
|
||||
Handle<Context> native_context = Handle<Context>(context->native_context());
|
||||
|
||||
@ -332,7 +333,7 @@ static Object* CompileGlobalEval(Isolate* isolate, Handle<String> source,
|
||||
ASSIGN_RETURN_ON_EXCEPTION_VALUE(
|
||||
isolate, compiled,
|
||||
Compiler::GetFunctionFromEval(source, outer_info, context, language_mode,
|
||||
restriction, eval_position),
|
||||
restriction, scope_position),
|
||||
isolate->heap()->exception());
|
||||
return *compiled;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ bytecodes: [
|
||||
B(Mov), R(closure), R(6),
|
||||
B(LdaZero),
|
||||
B(Star), R(7),
|
||||
B(LdaSmi), U8(52),
|
||||
B(LdaSmi), U8(30),
|
||||
B(Star), R(8),
|
||||
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
|
||||
B(Star), R(1),
|
||||
|
@ -34,7 +34,7 @@ bytecodes: [
|
||||
B(Mov), R(closure), R(6),
|
||||
B(LdaZero),
|
||||
B(Star), R(7),
|
||||
B(LdaSmi), U8(41),
|
||||
B(LdaSmi), U8(30),
|
||||
B(Star), R(8),
|
||||
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
|
||||
B(Star), R(1),
|
||||
|
@ -647,3 +647,119 @@ constant pool: [
|
||||
handlers: [
|
||||
]
|
||||
|
||||
---
|
||||
snippet: "
|
||||
function f(a, b) {
|
||||
if (a == b) { return 1; }
|
||||
if (a === b) { return 1; }
|
||||
if (a < b) { return 1; }
|
||||
if (a > b) { return 1; }
|
||||
if (a <= b) { return 1; }
|
||||
if (a >= b) { return 1; }
|
||||
if (a in b) { return 1; }
|
||||
if (a instanceof b) { return 1; }
|
||||
return 0;
|
||||
}
|
||||
f(1, 1);
|
||||
"
|
||||
frame size: 1
|
||||
parameter count: 3
|
||||
bytecode array length: 107
|
||||
bytecodes: [
|
||||
B(StackCheck),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestEqual), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestEqualStrict), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestLessThan), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestGreaterThan), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestLessThanOrEqual), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestGreaterThanOrEqual), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestIn), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(Ldar), R(arg0),
|
||||
B(Star), R(0),
|
||||
B(Ldar), R(arg1),
|
||||
B(TestInstanceOf), R(0),
|
||||
B(JumpIfFalse), U8(5),
|
||||
B(LdaSmi), U8(1),
|
||||
B(Return),
|
||||
B(LdaZero),
|
||||
B(Return),
|
||||
]
|
||||
constant pool: [
|
||||
]
|
||||
handlers: [
|
||||
]
|
||||
|
||||
---
|
||||
snippet: "
|
||||
function f() {
|
||||
var a = 0;
|
||||
if (a) {
|
||||
return 20;
|
||||
} else {
|
||||
return -20;
|
||||
}
|
||||
};
|
||||
f();
|
||||
"
|
||||
frame size: 1
|
||||
parameter count: 1
|
||||
bytecode array length: 14
|
||||
bytecodes: [
|
||||
B(StackCheck),
|
||||
B(LdaZero),
|
||||
B(Star), R(0),
|
||||
B(JumpIfToBooleanFalse), U8(5),
|
||||
B(LdaSmi), U8(20),
|
||||
B(Return),
|
||||
B(LdaSmi), U8(-20),
|
||||
B(Return),
|
||||
B(LdaUndefined),
|
||||
B(Return),
|
||||
]
|
||||
constant pool: [
|
||||
]
|
||||
handlers: [
|
||||
]
|
||||
|
||||
|
@ -34,7 +34,7 @@ bytecodes: [
|
||||
B(Mov), R(closure), R(6),
|
||||
B(LdaZero),
|
||||
B(Star), R(7),
|
||||
B(LdaSmi), U8(34),
|
||||
B(LdaSmi), U8(30),
|
||||
B(Star), R(8),
|
||||
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
|
||||
B(Star), R(1),
|
||||
@ -77,7 +77,7 @@ bytecodes: [
|
||||
B(Mov), R(closure), R(6),
|
||||
B(LdaZero),
|
||||
B(Star), R(7),
|
||||
B(LdaSmi), U8(34),
|
||||
B(LdaSmi), U8(30),
|
||||
B(Star), R(8),
|
||||
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
|
||||
B(Star), R(1),
|
||||
@ -123,7 +123,7 @@ bytecodes: [
|
||||
B(Mov), R(closure), R(6),
|
||||
B(LdaZero),
|
||||
B(Star), R(7),
|
||||
B(LdaSmi), U8(49),
|
||||
B(LdaSmi), U8(30),
|
||||
B(Star), R(8),
|
||||
B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(5),
|
||||
B(Star), R(1),
|
||||
|
@ -1,37 +0,0 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
Error.prepareStackTrace = function(exception, frames) {
|
||||
return frames[0].getEvalOrigin();
|
||||
}
|
||||
|
||||
var source = "new Error()";
|
||||
var eval_origin;
|
||||
var geval = eval;
|
||||
var log = [];
|
||||
|
||||
(function() {
|
||||
log.push([geval(source).stack, "15:13"]);
|
||||
log.push([geval(source).stack, "16:13"]);
|
||||
log.push([geval(source).stack, "17:13"]);
|
||||
})();
|
||||
|
||||
(function() {
|
||||
log.push([eval(source).stack, "21:13"]);
|
||||
log.push([eval(source).stack, "22:13"]);
|
||||
log.push([eval(source).stack, "23:13"]);
|
||||
})();
|
||||
|
||||
log.push([eval(source).stack, "26:11"]);
|
||||
log.push([eval(source).stack, "27:11"]);
|
||||
log.push([eval(source).stack, "28:11"]);
|
||||
|
||||
Error.prepareStackTrace = undefined;
|
||||
|
||||
for (var item of log) {
|
||||
var stacktraceline = item[0];
|
||||
var expectation = item[1];
|
||||
var re = new RegExp(`:${expectation}\\)$`);
|
||||
assertTrue(re.test(stacktraceline));
|
||||
}
|
Loading…
Reference in New Issue
Block a user