Commit bcd9aefb authored by neis's avatar neis Committed by Commit bot

[ignition] Reuse code-stub-assembler's context load operations.

- Remove (one version of) InterpreterAssembler::LoadContextSlot in favor of the
  identical CodeStubAssembler::LoadContextElement.
- Use CodeStubAssembler::LoadNativeContext instead of doing the load manually.

R=rmcilroy@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2470253003
Cr-Commit-Position: refs/heads/master@{#40766}
parent cadcd787
......@@ -104,7 +104,7 @@ Node* InterpreterAssembler::GetContextAtDepth(Node* context, Node* depth) {
{
cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
cur_context.Bind(
LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
LoadContextElement(cur_context.value(), Context::PREVIOUS_INDEX));
Branch(Word32Equal(cur_depth.value(), Int32Constant(0)), &context_found,
&context_search);
......@@ -135,14 +135,14 @@ void InterpreterAssembler::GotoIfHasContextExtensionUpToDepth(Node* context,
// contexts actually need to be checked.
Node* extension_slot =
LoadContextSlot(cur_context.value(), Context::EXTENSION_INDEX);
LoadContextElement(cur_context.value(), Context::EXTENSION_INDEX);
// Jump to the target if the extension slot is not a hole.
GotoIf(WordNotEqual(extension_slot, TheHoleConstant()), target);
cur_depth.Bind(Int32Sub(cur_depth.value(), Int32Constant(1)));
cur_context.Bind(
LoadContextSlot(cur_context.value(), Context::PREVIOUS_INDEX));
LoadContextElement(cur_context.value(), Context::PREVIOUS_INDEX));
GotoIf(Word32NotEqual(cur_depth.value(), Int32Constant(0)),
&context_search);
......@@ -485,11 +485,6 @@ Node* InterpreterAssembler::LoadAndUntagConstantPoolEntry(Node* index) {
}
}
Node* InterpreterAssembler::LoadContextSlot(Node* context, int slot_index) {
return Load(MachineType::AnyTagged(), context,
IntPtrConstant(Context::SlotOffset(slot_index)));
}
Node* InterpreterAssembler::LoadContextSlot(Node* context, Node* slot_index) {
Node* offset =
IntPtrAdd(WordShl(slot_index, kPointerSizeLog2),
......
......@@ -94,7 +94,6 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler {
compiler::Node* LoadAndUntagConstantPoolEntry(compiler::Node* index);
// Load |slot_index| from |context|.
compiler::Node* LoadContextSlot(compiler::Node* context, int slot_index);
compiler::Node* LoadContextSlot(compiler::Node* context,
compiler::Node* slot_index);
// Stores |value| into |slot_index| of |context|.
......
......@@ -497,9 +497,9 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
// Get the global object.
Node* context = __ GetContext();
Node* native_context =
__ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
Node* global = __ LoadContextSlot(native_context, Context::EXTENSION_INDEX);
Node* native_context = __ LoadNativeContext(context);
Node* global =
__ LoadContextElement(native_context, Context::EXTENSION_INDEX);
// Store the global via the StoreIC.
Node* code_target = __ HeapConstant(ic.code());
......@@ -1757,8 +1757,7 @@ void Interpreter::DoCallJSRuntime(InterpreterAssembler* assembler) {
// Get the function to call from the native context.
Node* context = __ GetContext();
Node* native_context =
__ LoadContextSlot(context, Context::NATIVE_CONTEXT_INDEX);
Node* native_context = __ LoadNativeContext(context);
Node* function = __ LoadContextSlot(native_context, context_index);
// Call the function.
......
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