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

Side by Side Diff: src/code-stub-assembler.cc

Issue 2811333002: [builtins] HasOwnProperty: handle non-internalized string keys (Closed)
Patch Set: fix Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 #include "src/code-stub-assembler.h" 4 #include "src/code-stub-assembler.h"
5 #include "src/code-factory.h" 5 #include "src/code-factory.h"
6 #include "src/frames-inl.h" 6 #include "src/frames-inl.h"
7 #include "src/frames.h" 7 #include "src/frames.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 4412 matching lines...) Expand 10 before | Expand all | Expand 10 after
4423 variable.Bind( 4423 variable.Bind(
4424 IntPtrOrSmiAdd(variable.value(), IntPtrOrSmiConstant(value, mode), mode)); 4424 IntPtrOrSmiAdd(variable.value(), IntPtrOrSmiConstant(value, mode), mode));
4425 } 4425 }
4426 4426
4427 void CodeStubAssembler::Use(Label* label) { 4427 void CodeStubAssembler::Use(Label* label) {
4428 GotoIf(Word32Equal(Int32Constant(0), Int32Constant(1)), label); 4428 GotoIf(Word32Equal(Int32Constant(0), Int32Constant(1)), label);
4429 } 4429 }
4430 4430
4431 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex, 4431 void CodeStubAssembler::TryToName(Node* key, Label* if_keyisindex,
4432 Variable* var_index, Label* if_keyisunique, 4432 Variable* var_index, Label* if_keyisunique,
4433 Variable* var_unique, Label* if_bailout) { 4433 Variable* var_unique, Label* if_bailout,
4434 Label* if_notinternalized) {
4434 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep()); 4435 DCHECK_EQ(MachineType::PointerRepresentation(), var_index->rep());
4435 DCHECK_EQ(MachineRepresentation::kTagged, var_unique->rep()); 4436 DCHECK_EQ(MachineRepresentation::kTagged, var_unique->rep());
4436 Comment("TryToName"); 4437 Comment("TryToName");
4437 4438
4438 Label if_hascachedindex(this), if_keyisnotindex(this), if_thinstring(this); 4439 Label if_hascachedindex(this), if_keyisnotindex(this), if_thinstring(this);
4439 // Handle Smi and HeapNumber keys. 4440 // Handle Smi and HeapNumber keys.
4440 var_index->Bind(TryToIntptr(key, &if_keyisnotindex)); 4441 var_index->Bind(TryToIntptr(key, &if_keyisnotindex));
4441 Goto(if_keyisindex); 4442 Goto(if_keyisindex);
4442 4443
4443 BIND(&if_keyisnotindex); 4444 BIND(&if_keyisnotindex);
(...skipping 18 matching lines...) Expand all
4462 // Check if we have a ThinString. 4463 // Check if we have a ThinString.
4463 GotoIf(Word32Equal(key_instance_type, Int32Constant(THIN_STRING_TYPE)), 4464 GotoIf(Word32Equal(key_instance_type, Int32Constant(THIN_STRING_TYPE)),
4464 &if_thinstring); 4465 &if_thinstring);
4465 GotoIf( 4466 GotoIf(
4466 Word32Equal(key_instance_type, Int32Constant(THIN_ONE_BYTE_STRING_TYPE)), 4467 Word32Equal(key_instance_type, Int32Constant(THIN_ONE_BYTE_STRING_TYPE)),
4467 &if_thinstring); 4468 &if_thinstring);
4468 // Finally, check if |key| is internalized. 4469 // Finally, check if |key| is internalized.
4469 STATIC_ASSERT(kNotInternalizedTag != 0); 4470 STATIC_ASSERT(kNotInternalizedTag != 0);
4470 Node* not_internalized = 4471 Node* not_internalized =
4471 Word32And(key_instance_type, Int32Constant(kIsNotInternalizedMask)); 4472 Word32And(key_instance_type, Int32Constant(kIsNotInternalizedMask));
4472 GotoIf(Word32NotEqual(not_internalized, Int32Constant(0)), if_bailout); 4473 GotoIf(Word32NotEqual(not_internalized, Int32Constant(0)),
4474 if_notinternalized != nullptr ? if_notinternalized : if_bailout);
4473 Goto(if_keyisunique); 4475 Goto(if_keyisunique);
4474 4476
4475 BIND(&if_thinstring); 4477 BIND(&if_thinstring);
4476 var_unique->Bind(LoadObjectField(key, ThinString::kActualOffset)); 4478 var_unique->Bind(LoadObjectField(key, ThinString::kActualOffset));
4477 Goto(if_keyisunique); 4479 Goto(if_keyisunique);
4478 4480
4479 BIND(&if_hascachedindex); 4481 BIND(&if_hascachedindex);
4480 var_index->Bind(DecodeWordFromWord32<Name::ArrayIndexValueBits>(hash)); 4482 var_index->Bind(DecodeWordFromWord32<Name::ArrayIndexValueBits>(hash));
4481 Goto(if_keyisindex); 4483 Goto(if_keyisindex);
4482 } 4484 }
(...skipping 4026 matching lines...) Expand 10 before | Expand all | Expand 10 after
8509 formatted.c_str(), TENURED); 8511 formatted.c_str(), TENURED);
8510 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), 8512 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(),
8511 HeapConstant(string)); 8513 HeapConstant(string));
8512 } 8514 }
8513 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); 8515 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value);
8514 #endif 8516 #endif
8515 } 8517 }
8516 8518
8517 } // namespace internal 8519 } // namespace internal
8518 } // namespace v8 8520 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698