Commit 0f772171 authored by Toon Verwaest's avatar Toon Verwaest Committed by Commit Bot

Remove the catch variable name from the extension field of catch contexts

Instead rely on the scope info containing the name as well.

Change-Id: Ie1f96ea023a793b11209510566f6831b1dfd40ab
Reviewed-on: https://chromium-review.googlesource.com/1042567
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52983}
parent a1892ff9
......@@ -2234,6 +2234,8 @@ void Scope::AllocateNonParameterLocal(Variable* var) {
if (var->IsUnallocated() && MustAllocate(var)) {
if (MustAllocateInContext(var)) {
AllocateHeapSlot(var);
DCHECK_IMPLIES(is_catch_scope(),
var->index() == Context::THROWN_OBJECT_INDEX);
} else {
AllocateStackSlot(var);
}
......
......@@ -1510,12 +1510,10 @@ void BytecodeGraphBuilder::VisitCreateEvalContext() {
void BytecodeGraphBuilder::VisitCreateCatchContext() {
interpreter::Register reg = bytecode_iterator().GetRegisterOperand(0);
Node* exception = environment()->LookupRegister(reg);
Handle<String> name =
Handle<String>::cast(bytecode_iterator().GetConstantForIndexOperand(1));
Handle<ScopeInfo> scope_info = Handle<ScopeInfo>::cast(
bytecode_iterator().GetConstantForIndexOperand(2));
bytecode_iterator().GetConstantForIndexOperand(1));
const Operator* op = javascript()->CreateCatchContext(name, scope_info);
const Operator* op = javascript()->CreateCatchContext(scope_info);
Node* context = NewNode(op, exception);
environment()->BindAccumulator(context);
}
......
......@@ -1350,14 +1350,12 @@ Reduction JSCreateLowering::ReduceJSCreateWithContext(Node* node) {
Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
DCHECK_EQ(IrOpcode::kJSCreateCatchContext, node->opcode());
const CreateCatchContextParameters& parameters =
CreateCatchContextParametersOf(node->op());
Handle<ScopeInfo> scope_info = parameters.scope_info();
Handle<String> catch_name = parameters.catch_name();
Handle<ScopeInfo> scope_info = ScopeInfoOf(node->op());
Node* exception = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
Node* control = NodeProperties::GetControlInput(node);
Node* context = NodeProperties::GetContextInput(node);
Node* extension = jsgraph()->TheHoleConstant();
AllocationBuilder a(jsgraph(), effect, control);
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == 4); // Ensure fully covered.
......@@ -1365,7 +1363,7 @@ Reduction JSCreateLowering::ReduceJSCreateCatchContext(Node* node) {
factory()->catch_context_map());
a.Store(AccessBuilder::ForContextSlot(Context::SCOPE_INFO_INDEX), scope_info);
a.Store(AccessBuilder::ForContextSlot(Context::PREVIOUS_INDEX), context);
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), catch_name);
a.Store(AccessBuilder::ForContextSlot(Context::EXTENSION_INDEX), extension);
a.Store(AccessBuilder::ForContextSlot(Context::NATIVE_CONTEXT_INDEX),
jsgraph()->HeapConstant(native_context()));
a.Store(AccessBuilder::ForContextSlot(Context::THROWN_OBJECT_INDEX),
......
......@@ -152,38 +152,6 @@ ContextAccess const& ContextAccessOf(Operator const* op) {
return OpParameter<ContextAccess>(op);
}
CreateCatchContextParameters::CreateCatchContextParameters(
Handle<String> catch_name, Handle<ScopeInfo> scope_info)
: catch_name_(catch_name), scope_info_(scope_info) {}
bool operator==(CreateCatchContextParameters const& lhs,
CreateCatchContextParameters const& rhs) {
return lhs.catch_name().location() == rhs.catch_name().location() &&
lhs.scope_info().location() == rhs.scope_info().location();
}
bool operator!=(CreateCatchContextParameters const& lhs,
CreateCatchContextParameters const& rhs) {
return !(lhs == rhs);
}
size_t hash_value(CreateCatchContextParameters const& parameters) {
return base::hash_combine(parameters.catch_name().location(),
parameters.scope_info().location());
}
std::ostream& operator<<(std::ostream& os,
CreateCatchContextParameters const& parameters) {
return os << Brief(*parameters.catch_name()) << ", "
<< Brief(*parameters.scope_info());
}
CreateCatchContextParameters const& CreateCatchContextParametersOf(
Operator const* op) {
DCHECK_EQ(IrOpcode::kJSCreateCatchContext, op->opcode());
return OpParameter<CreateCatchContextParameters>(op);
}
CreateFunctionContextParameters::CreateFunctionContextParameters(
Handle<ScopeInfo> scope_info, int slot_count, ScopeType scope_type)
: scope_info_(scope_info),
......@@ -1243,13 +1211,12 @@ const Operator* JSOperatorBuilder::CreateFunctionContext(
}
const Operator* JSOperatorBuilder::CreateCatchContext(
const Handle<String>& name, const Handle<ScopeInfo>& scope_info) {
CreateCatchContextParameters parameters(name, scope_info);
return new (zone()) Operator1<CreateCatchContextParameters>(
const Handle<ScopeInfo>& scope_info) {
return new (zone()) Operator1<Handle<ScopeInfo>>(
IrOpcode::kJSCreateCatchContext, Operator::kNoProperties, // opcode
"JSCreateCatchContext", // name
1, 1, 1, 1, 1, 2, // counts
parameters); // parameter
scope_info); // parameter
}
const Operator* JSOperatorBuilder::CreateWithContext(
......@@ -1272,7 +1239,8 @@ const Operator* JSOperatorBuilder::CreateBlockContext(
Handle<ScopeInfo> ScopeInfoOf(const Operator* op) {
DCHECK(IrOpcode::kJSCreateBlockContext == op->opcode() ||
IrOpcode::kJSCreateWithContext == op->opcode());
IrOpcode::kJSCreateWithContext == op->opcode() ||
IrOpcode::kJSCreateCatchContext == op->opcode());
return OpParameter<Handle<ScopeInfo>>(op);
}
......
......@@ -262,34 +262,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, ContextAccess const&);
V8_EXPORT_PRIVATE ContextAccess const& ContextAccessOf(Operator const*);
// Defines the name and ScopeInfo for a new catch context. This is used as a
// parameter by the JSCreateCatchContext operator.
class CreateCatchContextParameters final {
public:
CreateCatchContextParameters(Handle<String> catch_name,
Handle<ScopeInfo> scope_info);
Handle<String> catch_name() const { return catch_name_; }
Handle<ScopeInfo> scope_info() const { return scope_info_; }
private:
Handle<String> const catch_name_;
Handle<ScopeInfo> const scope_info_;
};
bool operator==(CreateCatchContextParameters const& lhs,
CreateCatchContextParameters const& rhs);
bool operator!=(CreateCatchContextParameters const& lhs,
CreateCatchContextParameters const& rhs);
size_t hash_value(CreateCatchContextParameters const& parameters);
std::ostream& operator<<(std::ostream& os,
CreateCatchContextParameters const& parameters);
CreateCatchContextParameters const& CreateCatchContextParametersOf(
Operator const*);
// Defines the slot count and ScopeType for a new function or eval context. This
// is used as a parameter by the JSCreateFunctionContext operator.
class CreateFunctionContextParameters final {
......@@ -838,8 +810,7 @@ class V8_EXPORT_PRIVATE JSOperatorBuilder final
const Operator* CreateFunctionContext(Handle<ScopeInfo> scope_info,
int slot_count, ScopeType scope_type);
const Operator* CreateCatchContext(const Handle<String>& name,
const Handle<ScopeInfo>& scope_info);
const Operator* CreateCatchContext(const Handle<ScopeInfo>& scope_info);
const Operator* CreateWithContext(const Handle<ScopeInfo>& scope_info);
const Operator* CreateBlockContext(const Handle<ScopeInfo>& scpope_info);
......
......@@ -90,7 +90,7 @@ Context* Context::closure_context() {
JSObject* Context::extension_object() {
DCHECK(IsNativeContext() || IsFunctionContext() || IsBlockContext() ||
IsEvalContext());
IsEvalContext() || IsCatchContext());
HeapObject* object = extension();
if (object->IsTheHole(GetIsolate())) return nullptr;
DCHECK(object->IsJSContextExtensionObject() ||
......@@ -116,12 +116,6 @@ Module* Context::module() {
return Module::cast(current->extension());
}
String* Context::catch_name() {
DCHECK(IsCatchContext());
return String::cast(extension());
}
JSGlobalObject* Context::global_object() {
return JSGlobalObject::cast(native_context()->extension());
}
......@@ -291,7 +285,7 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
// 2. Check the context proper if it has slots.
if (context->IsFunctionContext() || context->IsBlockContext() ||
context->IsScriptContext() || context->IsEvalContext() ||
context->IsModuleContext()) {
context->IsModuleContext() || context->IsCatchContext()) {
// Use serialized scope information of functions and blocks to search
// for the context index.
Handle<ScopeInfo> scope_info(context->scope_info());
......@@ -357,18 +351,6 @@ Handle<Object> Context::Lookup(Handle<String> name, ContextLookupFlags flags,
return handle(context->module(), isolate);
}
}
} else if (context->IsCatchContext()) {
// Catch contexts have the variable name in the extension slot.
if (String::Equals(name, handle(context->catch_name()))) {
if (FLAG_trace_contexts) {
PrintF("=> found in catch context\n");
}
*index = Context::THROWN_OBJECT_INDEX;
*attributes = NONE;
*init_flag = kCreatedInitialized;
*variable_mode = VAR;
return context;
}
} else if (context->IsDebugEvaluateContext()) {
// Check materialized locals.
Object* ext = context->get(EXTENSION_INDEX);
......
......@@ -382,9 +382,6 @@ class ScriptContextTable : public FixedArray {
//
// [ extension ] Additional data.
//
// For catch contexts, it contains the name of the catch
// variable.
//
// For module contexts, it contains the module object.
//
// For block contexts, it may contain an "extension object"
......@@ -480,7 +477,6 @@ class Context: public FixedArray {
JSObject* extension_object();
JSReceiver* extension_receiver();
ScopeInfo* scope_info();
String* catch_name();
// Find the module context (assuming there is one) and return the associated
// module object.
......
......@@ -339,11 +339,10 @@ MaybeHandle<JSObject> ScopeIterator::ScopeObject() {
return MaterializeLocalScope();
case ScopeIterator::ScopeTypeWith:
return WithContextExtension();
case ScopeIterator::ScopeTypeCatch:
return MaterializeCatchScope();
case ScopeIterator::ScopeTypeClosure:
// Materialize the content of the closure scope into a JSObject.
return MaterializeClosure();
case ScopeIterator::ScopeTypeCatch:
case ScopeIterator::ScopeTypeBlock:
case ScopeIterator::ScopeTypeEval:
return MaterializeInnerScope();
......@@ -376,12 +375,11 @@ bool ScopeIterator::SetVariableValue(Handle<String> variable_name,
return SetLocalVariableValue(variable_name, new_value);
case ScopeIterator::ScopeTypeWith:
break;
case ScopeIterator::ScopeTypeCatch:
return SetCatchVariableValue(variable_name, new_value);
case ScopeIterator::ScopeTypeClosure:
return SetClosureVariableValue(variable_name, new_value);
case ScopeIterator::ScopeTypeScript:
return SetScriptVariableValue(variable_name, new_value);
case ScopeIterator::ScopeTypeCatch:
case ScopeIterator::ScopeTypeBlock:
case ScopeIterator::ScopeTypeEval:
return SetInnerScopeVariableValue(variable_name, new_value);
......@@ -398,7 +396,7 @@ Handle<ScopeInfo> ScopeIterator::CurrentScopeInfo() {
if (HasNestedScopeChain()) {
return LastNestedScopeChain().scope_info;
} else if (context_->IsBlockContext() || context_->IsFunctionContext() ||
context_->IsEvalContext()) {
context_->IsEvalContext() || context_->IsCatchContext()) {
return Handle<ScopeInfo>(context_->scope_info());
}
return Handle<ScopeInfo>::null();
......@@ -598,22 +596,6 @@ Handle<JSObject> ScopeIterator::MaterializeClosure() {
}
// Create a plain JSObject which materializes the scope for the specified
// catch context.
Handle<JSObject> ScopeIterator::MaterializeCatchScope() {
Handle<Context> context = CurrentContext();
DCHECK(context->IsCatchContext());
Handle<String> name(context->catch_name());
Handle<Object> thrown_object(context->get(Context::THROWN_OBJECT_INDEX),
isolate_);
Handle<JSObject> catch_scope =
isolate_->factory()->NewJSObjectWithNullProto();
JSObject::SetOwnPropertyIgnoreAttributes(catch_scope, name, thrown_object,
NONE)
.Check();
return catch_scope;
}
// Retrieve the with-context extension object. If the extension object is
// a proxy, return an empty object.
Handle<JSObject> ScopeIterator::WithContextExtension() {
......@@ -812,7 +794,8 @@ bool ScopeIterator::SetInnerScopeVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
Handle<ScopeInfo> scope_info = CurrentScopeInfo();
DCHECK(scope_info->scope_type() == BLOCK_SCOPE ||
scope_info->scope_type() == EVAL_SCOPE);
scope_info->scope_type() == EVAL_SCOPE ||
scope_info->scope_type() == CATCH_SCOPE);
// Setting stack locals of optimized frames is not supported.
if (SetStackVariableValue(scope_info, variable_name, new_value)) {
......@@ -855,19 +838,6 @@ bool ScopeIterator::SetScriptVariableValue(Handle<String> variable_name,
return false;
}
bool ScopeIterator::SetCatchVariableValue(Handle<String> variable_name,
Handle<Object> new_value) {
Handle<Context> context = CurrentContext();
DCHECK(context->IsCatchContext());
Handle<String> name(context->catch_name());
if (!String::Equals(name, variable_name)) {
return false;
}
context->set(Context::THROWN_OBJECT_INDEX, *new_value);
return true;
}
void ScopeIterator::CopyContextLocalsToScopeObject(
Handle<ScopeInfo> scope_info, Handle<Context> context,
Handle<JSObject> scope_object) {
......
......@@ -139,7 +139,6 @@ class ScopeIterator {
V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeLocalScope();
V8_WARN_UNUSED_RESULT MaybeHandle<JSObject> MaterializeModuleScope();
Handle<JSObject> MaterializeClosure();
Handle<JSObject> MaterializeCatchScope();
Handle<JSObject> MaterializeInnerScope();
Handle<JSObject> WithContextExtension();
......@@ -151,8 +150,6 @@ class ScopeIterator {
Handle<Object> new_value);
bool SetScriptVariableValue(Handle<String> variable_name,
Handle<Object> new_value);
bool SetCatchVariableValue(Handle<String> variable_name,
Handle<Object> new_value);
bool SetModuleVariableValue(Handle<String> variable_name,
Handle<Object> new_value);
......
......@@ -1331,14 +1331,13 @@ Handle<Context> Factory::NewFunctionContext(Handle<Context> outer,
Handle<Context> Factory::NewCatchContext(Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<String> name,
Handle<Object> thrown_object) {
STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX);
Handle<Context> context = NewFixedArrayWithMap<Context>(
Heap::kCatchContextMapRootIndex, Context::MIN_CONTEXT_SLOTS + 1);
context->set_scope_info(*scope_info);
context->set_previous(*previous);
context->set_extension(*name);
context->set_extension(*the_hole_value());
context->set_native_context(previous->native_context());
context->set(Context::THROWN_OBJECT_INDEX, *thrown_object);
return context;
......
......@@ -370,7 +370,6 @@ class V8_EXPORT_PRIVATE Factory {
// Create a catch context.
Handle<Context> NewCatchContext(Handle<Context> previous,
Handle<ScopeInfo> scope_info,
Handle<String> name,
Handle<Object> thrown_object);
// Create a 'with' context.
......
......@@ -906,10 +906,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateBlockContext(
}
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateCatchContext(
Register exception, const AstRawString* name, const Scope* scope) {
size_t name_index = GetConstantPoolEntry(name);
Register exception, const Scope* scope) {
size_t scope_index = GetConstantPoolEntry(scope);
OutputCreateCatchContext(exception, name_index, scope_index);
OutputCreateCatchContext(exception, scope_index);
return *this;
}
......
......@@ -208,14 +208,11 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
BytecodeArrayBuilder& CreateClosure(size_t shared_function_info_entry,
int slot, int flags);
// Create a new local context for a |scope| and a closure which should be
// in the accumulator.
// Create a new local context for a |scope|.
BytecodeArrayBuilder& CreateBlockContext(const Scope* scope);
// Create a new context for a catch block with |exception|, |name|,
// |scope|, and the closure in the accumulator.
// Create a new context for a catch block with |exception| and |scope|.
BytecodeArrayBuilder& CreateCatchContext(Register exception,
const AstRawString* name,
const Scope* scope);
// Create a new context with the given |scope| and size |slots|.
......@@ -225,7 +222,7 @@ class V8_EXPORT_PRIVATE BytecodeArrayBuilder final {
BytecodeArrayBuilder& CreateEvalContext(const Scope* scope, int slots);
// Creates a new context with the given |scope| for a with-statement
// with the |object| in a register and the closure in the accumulator.
// with the |object| in a register.
BytecodeArrayBuilder& CreateWithContext(Register object, const Scope* scope);
// Create a new arguments object in the accumulator.
......
......@@ -4680,8 +4680,7 @@ void BytecodeGenerator::BuildNewLocalCatchContext(Scope* scope) {
Register exception = register_allocator()->NewRegister();
builder()->StoreAccumulatorInRegister(exception);
builder()->CreateCatchContext(exception, scope->catch_variable()->raw_name(),
scope);
builder()->CreateCatchContext(exception, scope);
}
void BytecodeGenerator::VisitObjectLiteralAccessor(
......
......@@ -263,7 +263,7 @@ namespace interpreter {
/* Context allocation */ \
V(CreateBlockContext, AccumulatorUse::kWrite, OperandType::kIdx) \
V(CreateCatchContext, AccumulatorUse::kWrite, OperandType::kReg, \
OperandType::kIdx, OperandType::kIdx) \
OperandType::kIdx) \
V(CreateFunctionContext, AccumulatorUse::kWrite, OperandType::kIdx, \
OperandType::kUImm) \
V(CreateEvalContext, AccumulatorUse::kWrite, OperandType::kIdx, \
......
......@@ -2527,17 +2527,16 @@ IGNITION_HANDLER(CreateBlockContext, InterpreterAssembler) {
Dispatch();
}
// CreateCatchContext <exception> <name_idx> <scope_info_idx>
// CreateCatchContext <exception> <scope_info_idx>
//
// Creates a new context for a catch block with the |exception| in a register,
// the variable name at |name_idx|, the ScopeInfo at |scope_info_idx|.
// Creates a new context for a catch block with the |exception| in a register
// and the ScopeInfo at |scope_info_idx|.
IGNITION_HANDLER(CreateCatchContext, InterpreterAssembler) {
Node* exception = LoadRegisterAtOperandIndex(0);
Node* name = LoadConstantPoolEntryAtOperandIndex(1);
Node* scope_info = LoadConstantPoolEntryAtOperandIndex(2);
Node* scope_info = LoadConstantPoolEntryAtOperandIndex(1);
Node* context = GetContext();
SetAccumulator(CallRuntime(Runtime::kPushCatchContext, context, name,
exception, scope_info));
SetAccumulator(
CallRuntime(Runtime::kPushCatchContext, context, exception, scope_info));
Dispatch();
}
......
......@@ -747,13 +747,12 @@ RUNTIME_FUNCTION(Runtime_PushModuleContext) {
RUNTIME_FUNCTION(Runtime_PushCatchContext) {
HandleScope scope(isolate);
DCHECK_EQ(3, args.length());
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
CONVERT_ARG_HANDLE_CHECKED(Object, thrown_object, 1);
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 2);
DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(Object, thrown_object, 0);
CONVERT_ARG_HANDLE_CHECKED(ScopeInfo, scope_info, 1);
Handle<Context> current(isolate->context(), isolate);
Handle<Context> context = isolate->factory()->NewCatchContext(
current, scope_info, name, thrown_object);
Handle<Context> context =
isolate->factory()->NewCatchContext(current, scope_info, thrown_object);
isolate->set_context(*context);
return *context;
}
......
......@@ -477,7 +477,7 @@ namespace internal {
F(NewSloppyArguments_Generic, 1, 1) \
F(NewStrictArguments, 1, 1) \
F(PushBlockContext, 1, 1) \
F(PushCatchContext, 3, 1) \
F(PushCatchContext, 2, 1) \
F(PushModuleContext, 2, 1) \
F(PushWithContext, 2, 1) \
F(StoreLookupSlot_Sloppy, 2, 1) \
......
......@@ -11,7 +11,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 246
bytecode array length: 245
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -46,9 +46,9 @@ bytecodes: [
B(LdaZero),
B(Star), R(5),
B(JumpLoop), U8(44), I8(0),
B(Jump), U8(34),
B(Jump), U8(33),
B(Star), R(13),
B(CreateCatchContext), R(13), U8(5), U8(6),
B(CreateCatchContext), R(13), U8(5),
B(PushContext), R(13),
B(Star), R(12),
B(LdaSmi), I8(2),
......@@ -73,7 +73,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(5), U8(14),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(7), U8(15),
B(LdaNamedProperty), R(2), U8(6), U8(15),
B(Star), R(7),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
......@@ -87,7 +87,7 @@ bytecodes: [
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(145),
B(Star), R(12),
B(LdaConstant), U8(8),
B(LdaConstant), U8(7),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2),
B(Throw),
......@@ -124,15 +124,14 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
]
handlers: [
[7, 122, 130],
[7, 121, 129],
[10, 88, 90],
[190, 200, 202],
[189, 199, 201],
]
---
......@@ -142,7 +141,7 @@ snippet: "
"
frame size: 16
parameter count: 1
bytecode array length: 256
bytecode array length: 255
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -178,10 +177,10 @@ bytecodes: [
/* 73 S> */ B(LdaZero),
B(Star), R(10),
B(Mov), R(7), R(11),
B(Jump), U8(50),
B(Jump), U8(34),
B(Jump), U8(49),
B(Jump), U8(33),
B(Star), R(14),
B(CreateCatchContext), R(14), U8(5), U8(6),
B(CreateCatchContext), R(14), U8(5),
B(PushContext), R(14),
B(Star), R(13),
B(LdaSmi), I8(2),
......@@ -206,7 +205,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(6), U8(13),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(3), U8(7), U8(14),
B(LdaNamedProperty), R(3), U8(6), U8(14),
B(Star), R(8),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
......@@ -220,7 +219,7 @@ bytecodes: [
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(145),
B(Star), R(13),
B(LdaConstant), U8(8),
B(LdaConstant), U8(7),
B(Star), R(14),
B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2),
B(Throw),
......@@ -244,7 +243,7 @@ bytecodes: [
B(Ldar), R(12),
B(SetPendingMessage),
B(Ldar), R(10),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(11),
/* 85 S> */ B(Return),
......@@ -259,7 +258,6 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
......@@ -267,9 +265,9 @@ constant pool: [
Smi [9],
]
handlers: [
[11, 125, 133],
[11, 124, 132],
[14, 91, 93],
[194, 204, 206],
[193, 203, 205],
]
---
......@@ -281,7 +279,7 @@ snippet: "
"
frame size: 15
parameter count: 1
bytecode array length: 264
bytecode array length: 263
bytecodes: [
/* 30 E> */ B(StackCheck),
B(LdaZero),
......@@ -324,9 +322,9 @@ bytecodes: [
B(LdaZero),
B(Star), R(5),
B(JumpLoop), U8(62), I8(0),
B(Jump), U8(34),
B(Jump), U8(33),
B(Star), R(13),
B(CreateCatchContext), R(13), U8(5), U8(6),
B(CreateCatchContext), R(13), U8(5),
B(PushContext), R(13),
B(Star), R(12),
B(LdaSmi), I8(2),
......@@ -351,7 +349,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(5), U8(16),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(2), U8(7), U8(17),
B(LdaNamedProperty), R(2), U8(6), U8(17),
B(Star), R(7),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
......@@ -365,7 +363,7 @@ bytecodes: [
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(145),
B(Star), R(12),
B(LdaConstant), U8(8),
B(LdaConstant), U8(7),
B(Star), R(13),
B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2),
B(Throw),
......@@ -402,15 +400,14 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
]
handlers: [
[7, 140, 148],
[7, 139, 147],
[10, 106, 108],
[208, 218, 220],
[207, 217, 219],
]
---
......@@ -420,7 +417,7 @@ snippet: "
"
frame size: 14
parameter count: 1
bytecode array length: 266
bytecode array length: 265
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(8),
......@@ -458,10 +455,10 @@ bytecodes: [
B(Star), R(9),
B(LdaZero),
B(Star), R(8),
B(Jump), U8(50),
B(Jump), U8(34),
B(Jump), U8(49),
B(Jump), U8(33),
B(Star), R(12),
B(CreateCatchContext), R(12), U8(7), U8(8),
B(CreateCatchContext), R(12), U8(7),
B(PushContext), R(12),
B(Star), R(11),
B(LdaSmi), I8(2),
......@@ -486,7 +483,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(4), U8(19),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(1), U8(9), U8(20),
B(LdaNamedProperty), R(1), U8(8), U8(20),
B(Star), R(6),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
......@@ -500,7 +497,7 @@ bytecodes: [
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(145),
B(Star), R(11),
B(LdaConstant), U8(10),
B(LdaConstant), U8(9),
B(Star), R(12),
B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2),
B(Throw),
......@@ -524,7 +521,7 @@ bytecodes: [
B(Ldar), R(10),
B(SetPendingMessage),
B(Ldar), R(8),
B(SwitchOnSmiNoFeedback), U8(11), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(9),
/* 105 S> */ B(Return),
......@@ -541,7 +538,6 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
......@@ -549,8 +545,8 @@ constant pool: [
Smi [9],
]
handlers: [
[15, 135, 143],
[15, 134, 142],
[18, 101, 103],
[204, 214, 216],
[203, 213, 215],
]
......@@ -100,7 +100,7 @@ snippet: "
"
frame size: 17
parameter count: 1
bytecode array length: 334
bytecode array length: 333
bytecodes: [
B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
B(Mov), R(closure), R(11),
......@@ -160,13 +160,13 @@ bytecodes: [
B(LdaZero),
B(Star), R(11),
B(Mov), R(15), R(12),
B(Jump), U8(56),
B(Jump), U8(55),
B(LdaZero),
B(Star), R(7),
B(JumpLoop), U8(84), I8(0),
B(Jump), U8(34),
B(Jump), U8(33),
B(Star), R(15),
B(CreateCatchContext), R(15), U8(11), U8(12),
B(CreateCatchContext), R(15), U8(11),
B(PushContext), R(15),
B(Star), R(14),
B(LdaSmi), I8(2),
......@@ -191,7 +191,7 @@ bytecodes: [
B(LdaZero),
B(TestEqualStrict), R(7), U8(14),
B(JumpIfTrue), U8(90),
B(LdaNamedProperty), R(4), U8(13), U8(15),
B(LdaNamedProperty), R(4), U8(12), U8(15),
B(Star), R(9),
B(TestUndetectable),
B(JumpIfFalse), U8(4),
......@@ -205,7 +205,7 @@ bytecodes: [
B(Jump), U8(18),
B(Wide), B(LdaSmi), I16(145),
B(Star), R(14),
B(LdaConstant), U8(14),
B(LdaConstant), U8(13),
B(Star), R(15),
B(CallRuntime), U16(Runtime::kNewTypeError), R(14), U8(2),
B(Throw),
......@@ -229,7 +229,7 @@ bytecodes: [
B(Ldar), R(13),
B(SetPendingMessage),
B(Ldar), R(11),
B(SwitchOnSmiNoFeedback), U8(15), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(14), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(12),
/* 44 S> */ B(Return),
......@@ -250,7 +250,6 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
Smi [15],
Smi [7],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"],
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
......@@ -258,9 +257,9 @@ constant pool: [
Smi [9],
]
handlers: [
[48, 203, 211],
[48, 202, 210],
[51, 169, 171],
[272, 282, 284],
[271, 281, 283],
]
---
......
......@@ -381,7 +381,7 @@ snippet: "
"
frame size: 12
parameter count: 1
bytecode array length: 135
bytecode array length: 134
bytecodes: [
/* 16 E> */ B(StackCheck),
B(CallJSRuntime), U8(%async_function_promise_create), R(0), U8(0),
......@@ -406,10 +406,10 @@ bytecodes: [
B(LdaZero),
B(Star), R(4),
B(Mov), R(3), R(5),
B(Jump), U8(56),
B(Jump), U8(40),
B(Jump), U8(55),
B(Jump), U8(39),
B(Star), R(8),
B(CreateCatchContext), R(8), U8(0), U8(1),
B(CreateCatchContext), R(8), U8(0),
B(Star), R(7),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -440,7 +440,7 @@ bytecodes: [
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(5),
/* 67 S> */ B(Return),
......@@ -450,13 +450,12 @@ bytecodes: [
/* 67 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[10, 94, 102],
[10, 93, 101],
[13, 54, 56],
]
......@@ -469,7 +468,7 @@ snippet: "
"
frame size: 11
parameter count: 1
bytecode array length: 186
bytecode array length: 185
bytecodes: [
B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
B(Mov), R(closure), R(3),
......@@ -512,10 +511,10 @@ bytecodes: [
B(LdaZero),
B(Star), R(3),
B(Mov), R(2), R(4),
B(Jump), U8(56),
B(Jump), U8(40),
B(Jump), U8(55),
B(Jump), U8(39),
B(Star), R(7),
B(CreateCatchContext), R(7), U8(1), U8(2),
B(CreateCatchContext), R(7), U8(1),
B(Star), R(6),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -546,7 +545,7 @@ bytecodes: [
B(Ldar), R(5),
B(SetPendingMessage),
B(Ldar), R(3),
B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Jump), U8(8),
B(Ldar), R(4),
/* 61 S> */ B(Return),
......@@ -557,13 +556,12 @@ bytecodes: [
]
constant pool: [
Smi [58],
ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"],
SCOPE_INFO_TYPE,
Smi [6],
Smi [9],
]
handlers: [
[26, 145, 153],
[26, 144, 152],
[29, 105, 107],
]
......@@ -11,15 +11,15 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 28
bytecode array length: 27
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(0),
/* 40 S> */ B(LdaSmi), I8(1),
/* 49 S> */ B(Return),
B(Jump), U8(19),
B(Jump), U8(18),
B(Star), R(1),
B(CreateCatchContext), R(1), U8(0), U8(1),
B(CreateCatchContext), R(1), U8(0),
B(Star), R(0),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -31,7 +31,6 @@ bytecodes: [
/* 75 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"],
SCOPE_INFO_TYPE,
]
handlers: [
......@@ -46,15 +45,15 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 57
bytecode array length: 55
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(1),
/* 47 S> */ B(LdaSmi), I8(1),
B(Star), R(0),
B(Jump), U8(18),
B(Jump), U8(17),
B(Star), R(2),
/* 49 E> */ B(CreateCatchContext), R(2), U8(0), U8(1),
/* 49 E> */ B(CreateCatchContext), R(2), U8(0),
B(Star), R(1),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -64,9 +63,9 @@ bytecodes: [
B(Mov), R(context), R(1),
/* 75 S> */ B(LdaSmi), I8(2),
B(Star), R(0),
B(Jump), U8(22),
B(Jump), U8(21),
B(Star), R(2),
/* 77 E> */ B(CreateCatchContext), R(2), U8(2), U8(3),
/* 77 E> */ B(CreateCatchContext), R(2), U8(1),
B(Star), R(1),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -79,13 +78,11 @@ bytecodes: [
/* 103 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e1"],
SCOPE_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e2"],
SCOPE_INFO_TYPE,
]
handlers: [
[4, 8, 10],
[29, 33, 35],
[28, 32, 34],
]
......@@ -55,7 +55,7 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 71
bytecode array length: 70
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
......@@ -64,9 +64,9 @@ bytecodes: [
B(Mov), R(context), R(4),
/* 51 S> */ B(LdaSmi), I8(2),
B(Star), R(0),
B(Jump), U8(22),
B(Jump), U8(21),
B(Star), R(5),
/* 53 E> */ B(CreateCatchContext), R(5), U8(0), U8(1),
/* 53 E> */ B(CreateCatchContext), R(5), U8(0),
B(Star), R(4),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -98,11 +98,10 @@ bytecodes: [
/* 99 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"],
SCOPE_INFO_TYPE,
]
handlers: [
[8, 37, 45],
[8, 36, 44],
[11, 15, 17],
]
......@@ -114,7 +113,7 @@ snippet: "
"
frame size: 7
parameter count: 1
bytecode array length: 92
bytecode array length: 90
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(3),
......@@ -122,9 +121,9 @@ bytecodes: [
B(Mov), R(context), R(5),
/* 55 S> */ B(LdaSmi), I8(1),
B(Star), R(0),
B(Jump), U8(22),
B(Jump), U8(21),
B(Star), R(6),
/* 57 E> */ B(CreateCatchContext), R(6), U8(0), U8(1),
/* 57 E> */ B(CreateCatchContext), R(6), U8(0),
B(Star), R(5),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -133,9 +132,9 @@ bytecodes: [
/* 74 S> */ B(LdaSmi), I8(2),
B(Star), R(0),
B(PopContext), R(6),
B(Jump), U8(22),
B(Jump), U8(21),
B(Star), R(5),
/* 76 E> */ B(CreateCatchContext), R(5), U8(0), U8(2),
/* 76 E> */ B(CreateCatchContext), R(5), U8(1),
B(Star), R(4),
B(LdaTheHole),
B(SetPendingMessage),
......@@ -167,13 +166,12 @@ bytecodes: [
/* 123 S> */ B(Return),
]
constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"],
SCOPE_INFO_TYPE,
SCOPE_INFO_TYPE,
]
handlers: [
[4, 58, 66],
[7, 36, 38],
[4, 56, 64],
[7, 35, 37],
[10, 14, 16],
]
......@@ -183,15 +183,14 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) {
// JSCreateCatchContext
TEST_F(JSCreateLoweringTest, JSCreateCatchContext) {
Handle<String> name = factory()->length_string();
Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1));
Node* const exception = Parameter(Type::Receiver());
Node* const context = Parameter(Type::Any());
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction r = Reduce(
graph()->NewNode(javascript()->CreateCatchContext(name, scope_info),
exception, context, effect, control));
Reduction r =
Reduce(graph()->NewNode(javascript()->CreateCatchContext(scope_info),
exception, context, effect, control));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor(
......
......@@ -168,7 +168,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit create context operation.
builder.CreateBlockContext(&scope);
builder.CreateCatchContext(reg, name, &scope);
builder.CreateCatchContext(reg, &scope);
builder.CreateFunctionContext(&scope, 1);
builder.CreateEvalContext(&scope, 1);
builder.CreateWithContext(reg, &scope);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment