Commit d5cca073 authored by Mike Stanton's avatar Mike Stanton Committed by Commit Bot

[CodeStubAssembler] Use typed TNodes for context operations

And less Node *. The creeping introduction of types.

Bug: v8:6949
Change-Id: I8a559ef03e14ede8110faa4c456bbb9ce6cf56ca
Reviewed-on: https://chromium-review.googlesource.com/730467Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Michael Stanton <mvstanton@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48791}
parent 3dfb90b6
......@@ -290,8 +290,8 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
// Check that the map of the initial array iterator hasn't changed.
Node* native_context = LoadNativeContext(context);
Node* arr_it_proto_map = LoadMap(LoadContextElement(
native_context, Context::INITIAL_ARRAY_ITERATOR_PROTOTYPE_INDEX));
Node* arr_it_proto_map = LoadMap(CAST(LoadContextElement(
native_context, Context::INITIAL_ARRAY_ITERATOR_PROTOTYPE_INDEX)));
Node* initial_map = LoadContextElement(
native_context, Context::INITIAL_ARRAY_ITERATOR_PROTOTYPE_MAP_INDEX);
GotoIfNot(WordEqual(arr_it_proto_map, initial_map), &if_runtime);
......
......@@ -1633,57 +1633,64 @@ Node* CodeStubAssembler::LoadDoubleWithHoleCheck(Node* base, Node* offset,
return Load(machine_type, base, offset);
}
Node* CodeStubAssembler::LoadContextElement(Node* context, int slot_index) {
TNode<Object> CodeStubAssembler::LoadContextElement(
SloppyTNode<Context> context, int slot_index) {
int offset = Context::SlotOffset(slot_index);
return Load(MachineType::AnyTagged(), context, IntPtrConstant(offset));
return UncheckedCast<Object>(
Load(MachineType::AnyTagged(), context, IntPtrConstant(offset)));
}
Node* CodeStubAssembler::LoadContextElement(Node* context, Node* slot_index) {
TNode<Object> CodeStubAssembler::LoadContextElement(
SloppyTNode<Context> context, SloppyTNode<IntPtrT> slot_index) {
Node* offset =
IntPtrAdd(TimesPointerSize(slot_index),
IntPtrConstant(Context::kHeaderSize - kHeapObjectTag));
return Load(MachineType::AnyTagged(), context, offset);
return UncheckedCast<Object>(Load(MachineType::AnyTagged(), context, offset));
}
Node* CodeStubAssembler::StoreContextElement(Node* context, int slot_index,
Node* value) {
void CodeStubAssembler::StoreContextElement(SloppyTNode<Context> context,
int slot_index,
SloppyTNode<Object> value) {
int offset = Context::SlotOffset(slot_index);
return Store(context, IntPtrConstant(offset), value);
Store(context, IntPtrConstant(offset), value);
}
Node* CodeStubAssembler::StoreContextElement(Node* context, Node* slot_index,
Node* value) {
void CodeStubAssembler::StoreContextElement(SloppyTNode<Context> context,
SloppyTNode<IntPtrT> slot_index,
SloppyTNode<Object> value) {
Node* offset =
IntPtrAdd(TimesPointerSize(slot_index),
IntPtrConstant(Context::kHeaderSize - kHeapObjectTag));
return Store(context, offset, value);
Store(context, offset, value);
}
Node* CodeStubAssembler::StoreContextElementNoWriteBarrier(Node* context,
int slot_index,
Node* value) {
void CodeStubAssembler::StoreContextElementNoWriteBarrier(
SloppyTNode<Context> context, int slot_index, SloppyTNode<Object> value) {
int offset = Context::SlotOffset(slot_index);
return StoreNoWriteBarrier(MachineRepresentation::kTagged, context,
IntPtrConstant(offset), value);
StoreNoWriteBarrier(MachineRepresentation::kTagged, context,
IntPtrConstant(offset), value);
}
Node* CodeStubAssembler::LoadNativeContext(Node* context) {
return LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX);
TNode<Context> CodeStubAssembler::LoadNativeContext(
SloppyTNode<Context> context) {
return UncheckedCast<Context>(
LoadContextElement(context, Context::NATIVE_CONTEXT_INDEX));
}
Node* CodeStubAssembler::LoadJSArrayElementsMap(Node* kind,
Node* native_context) {
TNode<Map> CodeStubAssembler::LoadJSArrayElementsMap(
SloppyTNode<Int32T> kind, SloppyTNode<Context> native_context) {
CSA_ASSERT(this, IsFastElementsKind(kind));
CSA_ASSERT(this, IsNativeContext(native_context));
Node* offset = IntPtrAdd(IntPtrConstant(Context::FIRST_JS_ARRAY_MAP_SLOT),
ChangeInt32ToIntPtr(kind));
return LoadContextElement(native_context, offset);
return UncheckedCast<Map>(LoadContextElement(native_context, offset));
}
Node* CodeStubAssembler::LoadJSArrayElementsMap(ElementsKind kind,
Node* native_context) {
TNode<Map> CodeStubAssembler::LoadJSArrayElementsMap(
ElementsKind kind, SloppyTNode<Context> native_context) {
CSA_ASSERT(this, IsNativeContext(native_context));
return LoadContextElement(native_context, Context::ArrayMapIndex(kind));
return UncheckedCast<Map>(
LoadContextElement(native_context, Context::ArrayMapIndex(kind)));
}
Node* CodeStubAssembler::LoadJSFunctionPrototype(Node* function,
......
......@@ -565,16 +565,24 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
ParameterMode parameter_mode = INTPTR_PARAMETERS);
// Context manipulation
Node* LoadContextElement(Node* context, int slot_index);
Node* LoadContextElement(Node* context, Node* slot_index);
Node* StoreContextElement(Node* context, int slot_index, Node* value);
Node* StoreContextElement(Node* context, Node* slot_index, Node* value);
Node* StoreContextElementNoWriteBarrier(Node* context, int slot_index,
Node* value);
Node* LoadNativeContext(Node* context);
Node* LoadJSArrayElementsMap(ElementsKind kind, Node* native_context);
Node* LoadJSArrayElementsMap(Node* kind, Node* native_context);
TNode<Object> LoadContextElement(SloppyTNode<Context> context,
int slot_index);
TNode<Object> LoadContextElement(SloppyTNode<Context> context,
SloppyTNode<IntPtrT> slot_index);
void StoreContextElement(SloppyTNode<Context> context, int slot_index,
SloppyTNode<Object> value);
void StoreContextElement(SloppyTNode<Context> context,
SloppyTNode<IntPtrT> slot_index,
SloppyTNode<Object> value);
void StoreContextElementNoWriteBarrier(SloppyTNode<Context> context,
int slot_index,
SloppyTNode<Object> value);
TNode<Context> LoadNativeContext(SloppyTNode<Context> context);
TNode<Map> LoadJSArrayElementsMap(ElementsKind kind,
SloppyTNode<Context> native_context);
TNode<Map> LoadJSArrayElementsMap(SloppyTNode<Int32T> kind,
SloppyTNode<Context> native_context);
// Load the "prototype" property of a JSFunction.
Node* LoadJSFunctionPrototype(Node* function, Label* if_bailout);
......
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