Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Unified Diff: src/code-stub-assembler.cc

Issue 2325013004: [stubs] Port LoadScriptContextFieldStub and StoreScriptContextFieldStub to TurboFan. (Closed)
Patch Set: Rebasing Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stub-assembler.cc
diff --git a/src/code-stub-assembler.cc b/src/code-stub-assembler.cc
index fff147e9b23ac1265ba9f319ef04a8e6b31c7942..833b4b20ead9bf58d4b0a06ee172b0a7356875bd 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -1172,9 +1172,13 @@ Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset,
return Load(machine_type, base, offset);
}
+Node* CodeStubAssembler::LoadContextElement(Node* context, int slot_index) {
+ int offset = Context::SlotOffset(slot_index);
+ return Load(MachineType::AnyTagged(), context, IntPtrConstant(offset));
+}
+
Node* CodeStubAssembler::LoadNativeContext(Node* context) {
- return LoadFixedArrayElement(context,
- IntPtrConstant(Context::NATIVE_CONTEXT_INDEX));
+ return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX);
}
Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind,
@@ -4434,9 +4438,8 @@ void CodeStubAssembler::LoadGlobalIC(const LoadICParameters* p) {
AssertInstanceType(handler, CODE_TYPE);
LoadWithVectorDescriptor descriptor(isolate());
Node* native_context = LoadNativeContext(p->context);
- Node* receiver = LoadFixedArrayElement(
- native_context, IntPtrConstant(Context::EXTENSION_INDEX), 0,
- INTPTR_PARAMETERS);
+ Node* receiver =
+ LoadContextElement(native_context, Context::EXTENSION_INDEX);
Node* fake_name = IntPtrConstant(0);
TailCallStub(descriptor, handler, p->context, receiver, fake_name, p->slot,
p->vector);
@@ -4577,7 +4580,11 @@ Node* CodeStubAssembler::EmitKeyedSloppyArguments(Node* receiver, Node* key,
mapped_index = SmiUntag(mapped_index);
Node* the_context = LoadFixedArrayElement(elements, IntPtrConstant(0), 0,
INTPTR_PARAMETERS);
+ // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement
+ // methods for accessing Context.
STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize);
+ DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag,
+ FixedArray::OffsetOfElementAt(0));
if (is_load) {
Node* result = LoadFixedArrayElement(the_context, mapped_index, 0,
INTPTR_PARAMETERS);
@@ -4619,6 +4626,17 @@ Node* CodeStubAssembler::EmitKeyedSloppyArguments(Node* receiver, Node* key,
return var_result.value();
}
+Node* CodeStubAssembler::LoadScriptContext(Node* context, int context_index) {
+ Node* native_context = LoadNativeContext(context);
+ Node* script_context_table =
+ LoadContextElement(native_context, Context::SCRIPT_CONTEXT_TABLE_INDEX);
+
+ int offset =
+ ScriptContextTable::GetContextOffset(context_index) - kHeapObjectTag;
+ return Load(MachineType::AnyTagged(), script_context_table,
+ IntPtrConstant(offset));
+}
+
Node* CodeStubAssembler::EnumLength(Node* map) {
Node* bitfield_3 = LoadMapBitField3(map);
Node* enum_length = BitFieldDecode<Map::EnumLengthBits>(bitfield_3);
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698