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

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

Issue 2446203003: [builtins] Fix Object.create(null) special case (Closed)
Patch Set: addressing nits Created 4 years, 2 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') | test/mjsunit/object-create.js » ('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 d0c891158b1e3ef6637ff2a06525b13054a5db9e..c588807048d95e1d7ae76cbe51ab6f37f283f0df 100644
--- a/src/code-stub-assembler.cc
+++ b/src/code-stub-assembler.cc
@@ -1111,11 +1111,14 @@ Node* CodeStubAssembler::LoadMapConstructor(Node* map) {
}
Node* CodeStubAssembler::IsSpecialReceiverMap(Node* map) {
+ Node* is_special = IsSpecialReceiverInstanceType(LoadMapInstanceType(map));
Node* bit_field = LoadMapBitField(map);
- Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor |
- 1 << Map::kIsAccessCheckNeeded);
- Assert(Word32Equal(Word32And(bit_field, mask), Int32Constant(0)));
- return IsSpecialReceiverInstanceType(LoadMapInstanceType(map));
+ uint32_t mask =
+ 1 << Map::kHasNamedInterceptor | 1 << Map::kIsAccessCheckNeeded;
+ // Interceptors or access checks imply special receiver.
+ CSA_ASSERT(
+ Select(IsSetWord32(bit_field, mask), is_special, Int32Constant(1)));
+ return is_special;
}
Node* CodeStubAssembler::IsSpecialReceiverInstanceType(Node* instance_type) {
@@ -6915,7 +6918,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_rhsisnotsmi);
{
- Assert(WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
+ CSA_ASSERT(WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
// Convert the {lhs} and {rhs} to floating point values, and
// perform a floating point comparison.
var_fcmp_lhs.Bind(SmiToFloat64(lhs));
@@ -6926,7 +6929,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_lhsisnotsmi);
{
- Assert(WordEqual(LoadMap(lhs), HeapNumberMapConstant()));
+ CSA_ASSERT(WordEqual(LoadMap(lhs), HeapNumberMapConstant()));
// Check if {rhs} is a Smi or a HeapObject.
Label if_rhsissmi(this), if_rhsisnotsmi(this);
@@ -6943,7 +6946,7 @@ void CodeStubAssembler::BranchIfNumericRelationalComparison(
Bind(&if_rhsisnotsmi);
{
- Assert(WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
+ CSA_ASSERT(WordEqual(LoadMap(rhs), HeapNumberMapConstant()));
// Convert the {lhs} and {rhs} to floating point values, and
// perform a floating point comparison.
@@ -8360,7 +8363,7 @@ compiler::Node* CodeStubAssembler::NumberInc(compiler::Node* value) {
Bind(&if_isnotsmi);
{
// Check if the value is a HeapNumber.
- Assert(IsHeapNumberMap(LoadMap(value)));
+ CSA_ASSERT(IsHeapNumberMap(LoadMap(value)));
// Load the HeapNumber value.
var_finc_value.Bind(LoadHeapNumberValue(value));
@@ -8415,7 +8418,7 @@ compiler::Node* CodeStubAssembler::CreateArrayIterator(
Context::UINT8_ARRAY_KEY_VALUE_ITERATOR_MAP_INDEX));
// Assert: Type(array) is Object
- Assert(IsJSReceiverInstanceType(array_type));
+ CSA_ASSERT(IsJSReceiverInstanceType(array_type));
Variable var_result(this, MachineRepresentation::kTagged);
Variable var_map_index(this, MachineType::PointerRepresentation());
@@ -8474,9 +8477,9 @@ compiler::Node* CodeStubAssembler::CreateArrayIterator(
Node* map_index =
IntPtrAdd(IntPtrConstant(kBaseMapIndex + kFastIteratorOffset),
LoadMapElementsKind(array_map));
- Assert(IntPtrGreaterThanOrEqual(
+ CSA_ASSERT(IntPtrGreaterThanOrEqual(
map_index, IntPtrConstant(kBaseMapIndex + kFastIteratorOffset)));
- Assert(IntPtrLessThan(
+ CSA_ASSERT(IntPtrLessThan(
map_index, IntPtrConstant(kBaseMapIndex + kSlowIteratorOffset)));
var_map_index.Bind(map_index);
@@ -8499,9 +8502,9 @@ compiler::Node* CodeStubAssembler::CreateArrayIterator(
Node* map_index =
IntPtrAdd(IntPtrConstant(kBaseMapIndex - UINT8_ELEMENTS),
LoadMapElementsKind(array_map));
- Assert(IntPtrLessThan(
+ CSA_ASSERT(IntPtrLessThan(
map_index, IntPtrConstant(kBaseMapIndex + kFastIteratorOffset)));
- Assert(
+ CSA_ASSERT(
IntPtrGreaterThanOrEqual(map_index, IntPtrConstant(kBaseMapIndex)));
var_map_index.Bind(map_index);
var_array_map.Bind(UndefinedConstant());
« no previous file with comments | « src/code-stub-assembler.h ('k') | test/mjsunit/object-create.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698