summaryrefslogtreecommitdiff
path: root/chromium/v8/src/codegen
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/codegen')
-rw-r--r--chromium/v8/src/codegen/code-stub-assembler.cc58
-rw-r--r--chromium/v8/src/codegen/code-stub-assembler.h28
2 files changed, 46 insertions, 40 deletions
diff --git a/chromium/v8/src/codegen/code-stub-assembler.cc b/chromium/v8/src/codegen/code-stub-assembler.cc
index e4f35ddcc88..392221e8725 100644
--- a/chromium/v8/src/codegen/code-stub-assembler.cc
+++ b/chromium/v8/src/codegen/code-stub-assembler.cc
@@ -2608,42 +2608,38 @@ TNode<BoolT> CodeStubAssembler::IsGeneratorFunction(
shared_function_info, SharedFunctionInfo::kFlagsOffset,
MachineType::Uint32()));
- return TNode<BoolT>::UncheckedCast(Word32Or(
- Word32Or(
- Word32Or(
- Word32Equal(function_kind,
- Int32Constant(FunctionKind::kAsyncGeneratorFunction)),
- Word32Equal(
- function_kind,
- Int32Constant(FunctionKind::kAsyncConciseGeneratorMethod))),
- Word32Equal(function_kind,
- Int32Constant(FunctionKind::kGeneratorFunction))),
- Word32Equal(function_kind,
- Int32Constant(FunctionKind::kConciseGeneratorMethod))));
-}
-
-TNode<BoolT> CodeStubAssembler::HasPrototypeSlot(TNode<JSFunction> function) {
- return TNode<BoolT>::UncheckedCast(IsSetWord32<Map::HasPrototypeSlotBit>(
- LoadMapBitField(LoadMap(function))));
-}
-
-TNode<BoolT> CodeStubAssembler::HasPrototypeProperty(TNode<JSFunction> function,
- TNode<Map> map) {
+ // See IsGeneratorFunction(FunctionKind kind).
+ return IsInRange(function_kind, FunctionKind::kAsyncConciseGeneratorMethod,
+ FunctionKind::kConciseGeneratorMethod);
+}
+
+TNode<BoolT> CodeStubAssembler::IsJSFunctionWithPrototypeSlot(
+ TNode<HeapObject> object) {
+ // Only JSFunction maps may have HasPrototypeSlotBit set.
+ return TNode<BoolT>::UncheckedCast(
+ IsSetWord32<Map::HasPrototypeSlotBit>(LoadMapBitField(LoadMap(object))));
+}
+
+void CodeStubAssembler::BranchIfHasPrototypeProperty(
+ TNode<JSFunction> function, TNode<Int32T> function_map_bit_field,
+ Label* if_true, Label* if_false) {
// (has_prototype_slot() && IsConstructor()) ||
// IsGeneratorFunction(shared()->kind())
uint32_t mask =
Map::HasPrototypeSlotBit::kMask | Map::IsConstructorBit::kMask;
- return TNode<BoolT>::UncheckedCast(
- Word32Or(IsAllSetWord32(LoadMapBitField(map), mask),
- IsGeneratorFunction(function)));
+
+ GotoIf(IsAllSetWord32(function_map_bit_field, mask), if_true);
+ Branch(IsGeneratorFunction(function), if_true, if_false);
}
void CodeStubAssembler::GotoIfPrototypeRequiresRuntimeLookup(
TNode<JSFunction> function, TNode<Map> map, Label* runtime) {
// !has_prototype_property() || has_non_instance_prototype()
- GotoIfNot(HasPrototypeProperty(function, map), runtime);
- GotoIf(IsSetWord32<Map::HasNonInstancePrototypeBit>(LoadMapBitField(map)),
- runtime);
+ TNode<Int32T> map_bit_field = LoadMapBitField(map);
+ Label next_check(this);
+ BranchIfHasPrototypeProperty(function, map_bit_field, &next_check, runtime);
+ BIND(&next_check);
+ GotoIf(IsSetWord32<Map::HasNonInstancePrototypeBit>(map_bit_field), runtime);
}
Node* CodeStubAssembler::LoadJSFunctionPrototype(Node* function,
@@ -13532,14 +13528,6 @@ TNode<BoolT> CodeStubAssembler::IsElementsKindLessThanOrEqual(
return Int32LessThanOrEqual(target_kind, Int32Constant(reference_kind));
}
-TNode<BoolT> CodeStubAssembler::IsElementsKindInRange(
- TNode<Int32T> target_kind, ElementsKind lower_reference_kind,
- ElementsKind higher_reference_kind) {
- return Uint32LessThanOrEqual(
- Int32Sub(target_kind, Int32Constant(lower_reference_kind)),
- Int32Constant(higher_reference_kind - lower_reference_kind));
-}
-
Node* CodeStubAssembler::IsDebugActive() {
Node* is_debug_active = Load(
MachineType::Uint8(),
diff --git a/chromium/v8/src/codegen/code-stub-assembler.h b/chromium/v8/src/codegen/code-stub-assembler.h
index 3a5a6233889..0db31fdfb83 100644
--- a/chromium/v8/src/codegen/code-stub-assembler.h
+++ b/chromium/v8/src/codegen/code-stub-assembler.h
@@ -374,6 +374,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return CAST(heap_object);
}
+ TNode<JSFunction> HeapObjectToJSFunctionWithPrototypeSlot(
+ TNode<HeapObject> heap_object, Label* fail) {
+ GotoIfNot(IsJSFunctionWithPrototypeSlot(heap_object), fail);
+ return CAST(heap_object);
+ }
+
Node* MatchesParameterMode(Node* value, ParameterMode mode);
#define PARAMETER_BINOP(OpName, IntPtrOpName, SmiOpName) \
@@ -727,6 +733,15 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> WordIsAligned(SloppyTNode<WordT> word, size_t alignment);
TNode<BoolT> WordIsPowerOfTwo(SloppyTNode<IntPtrT> value);
+ // Check if lower_limit <= value <= higher_limit.
+ template <typename U>
+ TNode<BoolT> IsInRange(TNode<Word32T> value, U lower_limit, U higher_limit) {
+ DCHECK_LE(lower_limit, higher_limit);
+ STATIC_ASSERT(sizeof(U) <= kInt32Size);
+ return Uint32LessThanOrEqual(Int32Sub(value, Int32Constant(lower_limit)),
+ Int32Constant(higher_limit - lower_limit));
+ }
+
#if DEBUG
void Bind(Label* label, AssemblerDebugInfo debug_info);
#endif // DEBUG
@@ -1274,9 +1289,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<Map> LoadJSArrayElementsMap(SloppyTNode<Int32T> kind,
SloppyTNode<Context> native_context);
- TNode<BoolT> HasPrototypeSlot(TNode<JSFunction> function);
+ TNode<BoolT> IsJSFunctionWithPrototypeSlot(TNode<HeapObject> object);
TNode<BoolT> IsGeneratorFunction(TNode<JSFunction> function);
- TNode<BoolT> HasPrototypeProperty(TNode<JSFunction> function, TNode<Map> map);
+ void BranchIfHasPrototypeProperty(TNode<JSFunction> function,
+ TNode<Int32T> function_map_bit_field,
+ Label* if_true, Label* if_false);
void GotoIfPrototypeRequiresRuntimeLookup(TNode<JSFunction> function,
TNode<Map> map, Label* runtime);
// Load the "prototype" property of a JSFunction.
@@ -2393,11 +2410,12 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
ElementsKind reference_kind);
TNode<BoolT> IsElementsKindLessThanOrEqual(TNode<Int32T> target_kind,
ElementsKind reference_kind);
- // Check if reference_kind_a <= target_kind <= reference_kind_b
+ // Check if lower_reference_kind <= target_kind <= higher_reference_kind.
TNode<BoolT> IsElementsKindInRange(TNode<Int32T> target_kind,
ElementsKind lower_reference_kind,
- ElementsKind higher_reference_kind);
-
+ ElementsKind higher_reference_kind) {
+ return IsInRange(target_kind, lower_reference_kind, higher_reference_kind);
+ }
// String helpers.
// Load a character from a String (might flatten a ConsString).
TNode<Int32T> StringCharCodeAt(SloppyTNode<String> string,