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

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

Issue 2419433008: Improve CodeStubAssembler assert functionality (Closed)
Patch Set: Fix memory leak 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 unified diff | Download patch
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4
5 #include "src/code-stub-assembler.h" 5 #include "src/code-stub-assembler.h"
6 #include "src/code-factory.h" 6 #include "src/code-factory.h"
7 #include "src/frames-inl.h" 7 #include "src/frames-inl.h"
8 #include "src/frames.h" 8 #include "src/frames.h"
9 #include "src/ic/handler-configuration.h" 9 #include "src/ic/handler-configuration.h"
10 #include "src/ic/stub-cache.h" 10 #include "src/ic/stub-cache.h"
11 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 14
15 using compiler::Node; 15 using compiler::Node;
16 16
17 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, 17 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
18 const CallInterfaceDescriptor& descriptor, 18 const CallInterfaceDescriptor& descriptor,
19 Code::Flags flags, const char* name, 19 Code::Flags flags, const char* name,
20 size_t result_size) 20 size_t result_size)
21 : compiler::CodeAssembler(isolate, zone, descriptor, flags, name, 21 : compiler::CodeAssembler(isolate, zone, descriptor, flags, name,
22 result_size) {} 22 result_size) {}
23 23
24 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone, 24 CodeStubAssembler::CodeStubAssembler(Isolate* isolate, Zone* zone,
25 int parameter_count, Code::Flags flags, 25 int parameter_count, Code::Flags flags,
26 const char* name) 26 const char* name)
27 : compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {} 27 : compiler::CodeAssembler(isolate, zone, parameter_count, flags, name) {}
28 28
29 void CodeStubAssembler::Assert(Node* condition) { 29 void CodeStubAssembler::Assert(Node* condition, const char* message,
30 const char* file, int line) {
30 #if defined(DEBUG) 31 #if defined(DEBUG)
31 Label ok(this); 32 Label ok(this);
32 Comment("[ Assert"); 33 if (message != nullptr && FLAG_code_comments) {
34 Comment("[ Assert: %s", message);
35 } else {
36 Comment("[ Assert ");
37 }
38
33 GotoIf(condition, &ok); 39 GotoIf(condition, &ok);
40 if (message != nullptr) {
41 char chars[1024];
42 Vector<char> buffer(chars);
43 if (file != nullptr) {
44 SNPrintF(buffer, "CSA_ASSERT failed: %s [%s:%d]\n", message, file, line);
45 } else {
46 SNPrintF(buffer, "CSA_ASSERT failed: %s\n", message);
47 }
48 CallRuntime(
49 Runtime::kGlobalPrint, SmiConstant(Smi::kZero),
50 HeapConstant(factory()->NewStringFromAsciiChecked(&(buffer[0]))));
51 }
34 DebugBreak(); 52 DebugBreak();
35 Goto(&ok); 53 Goto(&ok);
36 Bind(&ok); 54 Bind(&ok);
37 Comment("] Assert"); 55 Comment("] Assert");
38 #endif 56 #endif
39 } 57 }
40 58
41 Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); } 59 Node* CodeStubAssembler::NoContextConstant() { return NumberConstant(0); }
42 60
43 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \ 61 #define HEAP_CONSTANT_ACCESSOR(rootName, name) \
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 Node* CodeStubAssembler::LoadMap(Node* object) { 914 Node* CodeStubAssembler::LoadMap(Node* object) {
897 return LoadObjectField(object, HeapObject::kMapOffset); 915 return LoadObjectField(object, HeapObject::kMapOffset);
898 } 916 }
899 917
900 Node* CodeStubAssembler::LoadInstanceType(Node* object) { 918 Node* CodeStubAssembler::LoadInstanceType(Node* object) {
901 return LoadMapInstanceType(LoadMap(object)); 919 return LoadMapInstanceType(LoadMap(object));
902 } 920 }
903 921
904 void CodeStubAssembler::AssertInstanceType(Node* object, 922 void CodeStubAssembler::AssertInstanceType(Node* object,
905 InstanceType instance_type) { 923 InstanceType instance_type) {
906 Assert(Word32Equal(LoadInstanceType(object), Int32Constant(instance_type))); 924 CSA_ASSERT(
925 Word32Equal(LoadInstanceType(object), Int32Constant(instance_type)));
907 } 926 }
908 927
909 Node* CodeStubAssembler::LoadProperties(Node* object) { 928 Node* CodeStubAssembler::LoadProperties(Node* object) {
910 return LoadObjectField(object, JSObject::kPropertiesOffset); 929 return LoadObjectField(object, JSObject::kPropertiesOffset);
911 } 930 }
912 931
913 Node* CodeStubAssembler::LoadElements(Node* object) { 932 Node* CodeStubAssembler::LoadElements(Node* object) {
914 return LoadObjectField(object, JSObject::kElementsOffset); 933 return LoadObjectField(object, JSObject::kElementsOffset);
915 } 934 }
916 935
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 } 975 }
957 976
958 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) { 977 Node* CodeStubAssembler::LoadMapInstanceSize(Node* map) {
959 return ChangeUint32ToWord( 978 return ChangeUint32ToWord(
960 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8())); 979 LoadObjectField(map, Map::kInstanceSizeOffset, MachineType::Uint8()));
961 } 980 }
962 981
963 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) { 982 Node* CodeStubAssembler::LoadMapInobjectProperties(Node* map) {
964 // See Map::GetInObjectProperties() for details. 983 // See Map::GetInObjectProperties() for details.
965 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE); 984 STATIC_ASSERT(LAST_JS_OBJECT_TYPE == LAST_TYPE);
966 Assert(Int32GreaterThanOrEqual(LoadMapInstanceType(map), 985 CSA_ASSERT(Int32GreaterThanOrEqual(LoadMapInstanceType(map),
967 Int32Constant(FIRST_JS_OBJECT_TYPE))); 986 Int32Constant(FIRST_JS_OBJECT_TYPE)));
968 return ChangeUint32ToWord(LoadObjectField( 987 return ChangeUint32ToWord(LoadObjectField(
969 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, 988 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset,
970 MachineType::Uint8())); 989 MachineType::Uint8()));
971 } 990 }
972 991
973 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) { 992 Node* CodeStubAssembler::LoadMapConstructorFunctionIndex(Node* map) {
974 // See Map::GetConstructorFunctionIndex() for details. 993 // See Map::GetConstructorFunctionIndex() for details.
975 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE); 994 STATIC_ASSERT(FIRST_PRIMITIVE_TYPE == FIRST_TYPE);
976 Assert(Int32LessThanOrEqual(LoadMapInstanceType(map), 995 CSA_ASSERT(Int32LessThanOrEqual(LoadMapInstanceType(map),
977 Int32Constant(LAST_PRIMITIVE_TYPE))); 996 Int32Constant(LAST_PRIMITIVE_TYPE)));
978 return ChangeUint32ToWord(LoadObjectField( 997 return ChangeUint32ToWord(LoadObjectField(
979 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset, 998 map, Map::kInObjectPropertiesOrConstructorFunctionIndexOffset,
980 MachineType::Uint8())); 999 MachineType::Uint8()));
981 } 1000 }
982 1001
983 Node* CodeStubAssembler::LoadMapConstructor(Node* map) { 1002 Node* CodeStubAssembler::LoadMapConstructor(Node* map) {
984 Variable result(this, MachineRepresentation::kTagged); 1003 Variable result(this, MachineRepresentation::kTagged);
985 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset)); 1004 result.Bind(LoadObjectField(map, Map::kConstructorOrBackPointerOffset));
986 1005
987 Label done(this), loop(this, &result); 1006 Label done(this), loop(this, &result);
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 MachineRepresentation::kTagged); 1400 MachineRepresentation::kTagged);
1382 StoreObjectFieldNoWriteBarrier(result, ConsString::kSecondOffset, second, 1401 StoreObjectFieldNoWriteBarrier(result, ConsString::kSecondOffset, second,
1383 MachineRepresentation::kTagged); 1402 MachineRepresentation::kTagged);
1384 return result; 1403 return result;
1385 } 1404 }
1386 1405
1387 Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length, 1406 Node* CodeStubAssembler::AllocateRegExpResult(Node* context, Node* length,
1388 Node* index, Node* input) { 1407 Node* index, Node* input) {
1389 Node* const max_length = 1408 Node* const max_length =
1390 SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray)); 1409 SmiConstant(Smi::FromInt(JSArray::kInitialMaxFastElementArray));
1391 Assert(SmiLessThanOrEqual(length, max_length)); 1410 CSA_ASSERT(SmiLessThanOrEqual(length, max_length));
1392 1411
1393 // Allocate the JSRegExpResult. 1412 // Allocate the JSRegExpResult.
1394 // TODO(jgruber): Fold JSArray and FixedArray allocations, then remove 1413 // TODO(jgruber): Fold JSArray and FixedArray allocations, then remove
1395 // unneeded store of elements. 1414 // unneeded store of elements.
1396 Node* const result = Allocate(JSRegExpResult::kSize); 1415 Node* const result = Allocate(JSRegExpResult::kSize);
1397 1416
1398 // TODO(jgruber): Store map as Heap constant? 1417 // TODO(jgruber): Store map as Heap constant?
1399 Node* const native_context = LoadNativeContext(context); 1418 Node* const native_context = LoadNativeContext(context);
1400 Node* const map = 1419 Node* const map =
1401 LoadContextElement(native_context, Context::REGEXP_RESULT_MAP_INDEX); 1420 LoadContextElement(native_context, Context::REGEXP_RESULT_MAP_INDEX);
(...skipping 1749 matching lines...) Expand 10 before | Expand all | Expand 10 after
3151 Goto(&end); 3170 Goto(&end);
3152 } 3171 }
3153 } 3172 }
3154 3173
3155 Bind(&end); 3174 Bind(&end);
3156 return var_result.value(); 3175 return var_result.value();
3157 } 3176 }
3158 3177
3159 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) { 3178 Node* CodeStubAssembler::NonNumberToNumber(Node* context, Node* input) {
3160 // Assert input is a HeapObject (not smi or heap number) 3179 // Assert input is a HeapObject (not smi or heap number)
3161 Assert(Word32BinaryNot(TaggedIsSmi(input))); 3180 CSA_ASSERT(Word32BinaryNot(TaggedIsSmi(input)));
3162 Assert(Word32NotEqual(LoadMap(input), HeapNumberMapConstant())); 3181 CSA_ASSERT(Word32NotEqual(LoadMap(input), HeapNumberMapConstant()));
3163 3182
3164 // We might need to loop once here due to ToPrimitive conversions. 3183 // We might need to loop once here due to ToPrimitive conversions.
3165 Variable var_input(this, MachineRepresentation::kTagged); 3184 Variable var_input(this, MachineRepresentation::kTagged);
3166 Variable var_result(this, MachineRepresentation::kTagged); 3185 Variable var_result(this, MachineRepresentation::kTagged);
3167 Label loop(this, &var_input); 3186 Label loop(this, &var_input);
3168 Label end(this); 3187 Label end(this);
3169 var_input.Bind(input); 3188 var_input.Bind(input);
3170 Goto(&loop); 3189 Goto(&loop);
3171 Bind(&loop); 3190 Bind(&loop);
3172 { 3191 {
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
3614 3633
3615 Label if_objectisspecial(this); 3634 Label if_objectisspecial(this);
3616 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE); 3635 STATIC_ASSERT(JS_GLOBAL_OBJECT_TYPE <= LAST_SPECIAL_RECEIVER_TYPE);
3617 GotoIf(Int32LessThanOrEqual(instance_type, 3636 GotoIf(Int32LessThanOrEqual(instance_type,
3618 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)), 3637 Int32Constant(LAST_SPECIAL_RECEIVER_TYPE)),
3619 &if_objectisspecial); 3638 &if_objectisspecial);
3620 3639
3621 Node* bit_field = LoadMapBitField(map); 3640 Node* bit_field = LoadMapBitField(map);
3622 Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor | 3641 Node* mask = Int32Constant(1 << Map::kHasNamedInterceptor |
3623 1 << Map::kIsAccessCheckNeeded); 3642 1 << Map::kIsAccessCheckNeeded);
3624 Assert(Word32Equal(Word32And(bit_field, mask), Int32Constant(0))); 3643 CSA_ASSERT(Word32Equal(Word32And(bit_field, mask), Int32Constant(0)));
3625 3644
3626 Node* bit_field3 = LoadMapBitField3(map); 3645 Node* bit_field3 = LoadMapBitField3(map);
3627 Node* bit = BitFieldDecode<Map::DictionaryMap>(bit_field3); 3646 Node* bit = BitFieldDecode<Map::DictionaryMap>(bit_field3);
3628 Label if_isfastmap(this), if_isslowmap(this); 3647 Label if_isfastmap(this), if_isslowmap(this);
3629 Branch(Word32Equal(bit, Int32Constant(0)), &if_isfastmap, &if_isslowmap); 3648 Branch(Word32Equal(bit, Int32Constant(0)), &if_isfastmap, &if_isslowmap);
3630 Bind(&if_isfastmap); 3649 Bind(&if_isfastmap);
3631 { 3650 {
3632 Comment("DescriptorArrayLookup"); 3651 Comment("DescriptorArrayLookup");
3633 Node* nof = BitFieldDecodeWord<Map::NumberOfOwnDescriptorsBits>(bit_field3); 3652 Node* nof = BitFieldDecodeWord<Map::NumberOfOwnDescriptorsBits>(bit_field3);
3634 // Bail out to the runtime for large numbers of own descriptors. The stub 3653 // Bail out to the runtime for large numbers of own descriptors. The stub
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
4029 { 4048 {
4030 Variable var_entry(this, MachineType::PointerRepresentation()); 4049 Variable var_entry(this, MachineType::PointerRepresentation());
4031 Node* elements = LoadElements(object); 4050 Node* elements = LoadElements(object);
4032 NumberDictionaryLookup<SeededNumberDictionary>( 4051 NumberDictionaryLookup<SeededNumberDictionary>(
4033 elements, intptr_index, if_found, &var_entry, if_not_found); 4052 elements, intptr_index, if_found, &var_entry, if_not_found);
4034 } 4053 }
4035 Bind(&if_isfaststringwrapper); 4054 Bind(&if_isfaststringwrapper);
4036 { 4055 {
4037 AssertInstanceType(object, JS_VALUE_TYPE); 4056 AssertInstanceType(object, JS_VALUE_TYPE);
4038 Node* string = LoadJSValueValue(object); 4057 Node* string = LoadJSValueValue(object);
4039 Assert(IsStringInstanceType(LoadInstanceType(string))); 4058 CSA_ASSERT(IsStringInstanceType(LoadInstanceType(string)));
4040 Node* length = LoadStringLength(string); 4059 Node* length = LoadStringLength(string);
4041 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); 4060 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found);
4042 Goto(&if_isobjectorsmi); 4061 Goto(&if_isobjectorsmi);
4043 } 4062 }
4044 Bind(&if_isslowstringwrapper); 4063 Bind(&if_isslowstringwrapper);
4045 { 4064 {
4046 AssertInstanceType(object, JS_VALUE_TYPE); 4065 AssertInstanceType(object, JS_VALUE_TYPE);
4047 Node* string = LoadJSValueValue(object); 4066 Node* string = LoadJSValueValue(object);
4048 Assert(IsStringInstanceType(LoadInstanceType(string))); 4067 CSA_ASSERT(IsStringInstanceType(LoadInstanceType(string)));
4049 Node* length = LoadStringLength(string); 4068 Node* length = LoadStringLength(string);
4050 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found); 4069 GotoIf(UintPtrLessThan(intptr_index, SmiUntag(length)), if_found);
4051 Goto(&if_isdictionary); 4070 Goto(&if_isdictionary);
4052 } 4071 }
4053 Bind(&if_oob); 4072 Bind(&if_oob);
4054 { 4073 {
4055 // Positive OOB indices mean "not found", negative indices must be 4074 // Positive OOB indices mean "not found", negative indices must be
4056 // converted to property names. 4075 // converted to property names.
4057 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), if_bailout); 4076 GotoIf(IntPtrLessThan(intptr_index, IntPtrConstant(0)), if_bailout);
4058 Goto(if_not_found); 4077 Goto(if_not_found);
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
4469 Goto(&loop); 4488 Goto(&loop);
4470 } 4489 }
4471 } 4490 }
4472 4491
4473 compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name, 4492 compiler::Node* CodeStubAssembler::StubCachePrimaryOffset(compiler::Node* name,
4474 compiler::Node* map) { 4493 compiler::Node* map) {
4475 // See v8::internal::StubCache::PrimaryOffset(). 4494 // See v8::internal::StubCache::PrimaryOffset().
4476 STATIC_ASSERT(StubCache::kCacheIndexShift == Name::kHashShift); 4495 STATIC_ASSERT(StubCache::kCacheIndexShift == Name::kHashShift);
4477 // Compute the hash of the name (use entire hash field). 4496 // Compute the hash of the name (use entire hash field).
4478 Node* hash_field = LoadNameHashField(name); 4497 Node* hash_field = LoadNameHashField(name);
4479 Assert(Word32Equal( 4498 CSA_ASSERT(Word32Equal(
4480 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)), 4499 Word32And(hash_field, Int32Constant(Name::kHashNotComputedMask)),
4481 Int32Constant(0))); 4500 Int32Constant(0)));
4482 4501
4483 // Using only the low bits in 64-bit mode is unlikely to increase the 4502 // Using only the low bits in 64-bit mode is unlikely to increase the
4484 // risk of collision even if the heap is spread over an area larger than 4503 // risk of collision even if the heap is spread over an area larger than
4485 // 4Gb (and not at all if it isn't). 4504 // 4Gb (and not at all if it isn't).
4486 Node* hash = Int32Add(hash_field, map); 4505 Node* hash = Int32Add(hash_field, map);
4487 // Base the offset on a simple combination of name and map. 4506 // Base the offset on a simple combination of name and map.
4488 hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic)); 4507 hash = Word32Xor(hash, Int32Constant(StubCache::kPrimaryMagic));
4489 uint32_t mask = (StubCache::kPrimaryTableSize - 1) 4508 uint32_t mask = (StubCache::kPrimaryTableSize - 1)
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
4950 Node* validity_cell = LoadObjectField(handler, Tuple3::kValue1Offset); 4969 Node* validity_cell = LoadObjectField(handler, Tuple3::kValue1Offset);
4951 Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset); 4970 Node* cell_value = LoadObjectField(validity_cell, Cell::kValueOffset);
4952 GotoIf(WordNotEqual(cell_value, 4971 GotoIf(WordNotEqual(cell_value,
4953 SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))), 4972 SmiConstant(Smi::FromInt(Map::kPrototypeChainValid))),
4954 miss); 4973 miss);
4955 4974
4956 Node* holder = 4975 Node* holder =
4957 LoadWeakCellValue(LoadObjectField(handler, Tuple3::kValue2Offset)); 4976 LoadWeakCellValue(LoadObjectField(handler, Tuple3::kValue2Offset));
4958 // The |holder| is guaranteed to be alive at this point since we passed 4977 // The |holder| is guaranteed to be alive at this point since we passed
4959 // both the receiver map check and the validity cell check. 4978 // both the receiver map check and the validity cell check.
4960 Assert(WordNotEqual(holder, IntPtrConstant(0))); 4979 CSA_ASSERT(WordNotEqual(holder, IntPtrConstant(0)));
4961 4980
4962 Node* smi_handler = LoadObjectField(handler, Tuple3::kValue3Offset); 4981 Node* smi_handler = LoadObjectField(handler, Tuple3::kValue3Offset);
4963 Assert(TaggedIsSmi(smi_handler)); 4982 CSA_ASSERT(TaggedIsSmi(smi_handler));
4964 4983
4965 var_holder.Bind(holder); 4984 var_holder.Bind(holder);
4966 var_smi_handler.Bind(smi_handler); 4985 var_smi_handler.Bind(smi_handler);
4967 Goto(&if_smi_handler); 4986 Goto(&if_smi_handler);
4968 } 4987 }
4969 4988
4970 // |handler| is a heap object. Must be code, call it. 4989 // |handler| is a heap object. Must be code, call it.
4971 Bind(&call_handler); 4990 Bind(&call_handler);
4972 { 4991 {
4973 typedef LoadWithVectorDescriptor Descriptor; 4992 typedef LoadWithVectorDescriptor Descriptor;
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
5337 5356
5338 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode); 5357 Node* delta = IntPtrOrSmiConstant(JSObject::kFieldsAdded, mode);
5339 Node* new_capacity = IntPtrAdd(length, delta); 5358 Node* new_capacity = IntPtrAdd(length, delta);
5340 5359
5341 // Grow properties array. 5360 // Grow properties array.
5342 ElementsKind kind = FAST_ELEMENTS; 5361 ElementsKind kind = FAST_ELEMENTS;
5343 DCHECK(kMaxNumberOfDescriptors + JSObject::kFieldsAdded < 5362 DCHECK(kMaxNumberOfDescriptors + JSObject::kFieldsAdded <
5344 FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind)); 5363 FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind));
5345 // The size of a new properties backing store is guaranteed to be small 5364 // The size of a new properties backing store is guaranteed to be small
5346 // enough that the new backing store will be allocated in new space. 5365 // enough that the new backing store will be allocated in new space.
5347 Assert(UintPtrLessThan(new_capacity, IntPtrConstant(kMaxNumberOfDescriptors + 5366 CSA_ASSERT(UintPtrLessThan(
5348 JSObject::kFieldsAdded))); 5367 new_capacity,
5368 IntPtrConstant(kMaxNumberOfDescriptors + JSObject::kFieldsAdded)));
5349 5369
5350 Node* new_properties = AllocateFixedArray(kind, new_capacity, mode); 5370 Node* new_properties = AllocateFixedArray(kind, new_capacity, mode);
5351 5371
5352 FillFixedArrayWithValue(kind, new_properties, length, new_capacity, 5372 FillFixedArrayWithValue(kind, new_properties, length, new_capacity,
5353 Heap::kUndefinedValueRootIndex, mode); 5373 Heap::kUndefinedValueRootIndex, mode);
5354 5374
5355 // |new_properties| is guaranteed to be in new space, so we can skip 5375 // |new_properties| is guaranteed to be in new space, so we can skip
5356 // the write barrier. 5376 // the write barrier.
5357 CopyFixedArrayElements(kind, properties, new_properties, length, 5377 CopyFixedArrayElements(kind, properties, new_properties, length,
5358 SKIP_WRITE_BARRIER, mode); 5378 SKIP_WRITE_BARRIER, mode);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
5485 Node* adjusted_length = IntPtrSub(elements_length, intptr_two); 5505 Node* adjusted_length = IntPtrSub(elements_length, intptr_two);
5486 5506
5487 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped); 5507 GotoIf(UintPtrGreaterThanOrEqual(key, adjusted_length), &if_unmapped);
5488 5508
5489 Node* mapped_index = LoadFixedArrayElement( 5509 Node* mapped_index = LoadFixedArrayElement(
5490 elements, IntPtrAdd(key, intptr_two), 0, INTPTR_PARAMETERS); 5510 elements, IntPtrAdd(key, intptr_two), 0, INTPTR_PARAMETERS);
5491 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped); 5511 Branch(WordEqual(mapped_index, TheHoleConstant()), &if_unmapped, &if_mapped);
5492 5512
5493 Bind(&if_mapped); 5513 Bind(&if_mapped);
5494 { 5514 {
5495 Assert(TaggedIsSmi(mapped_index)); 5515 CSA_ASSERT(TaggedIsSmi(mapped_index));
5496 mapped_index = SmiUntag(mapped_index); 5516 mapped_index = SmiUntag(mapped_index);
5497 Node* the_context = LoadFixedArrayElement(elements, IntPtrConstant(0), 0, 5517 Node* the_context = LoadFixedArrayElement(elements, IntPtrConstant(0), 0,
5498 INTPTR_PARAMETERS); 5518 INTPTR_PARAMETERS);
5499 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement 5519 // Assert that we can use LoadFixedArrayElement/StoreFixedArrayElement
5500 // methods for accessing Context. 5520 // methods for accessing Context.
5501 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize); 5521 STATIC_ASSERT(Context::kHeaderSize == FixedArray::kHeaderSize);
5502 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag, 5522 DCHECK_EQ(Context::SlotOffset(0) + kHeapObjectTag,
5503 FixedArray::OffsetOfElementAt(0)); 5523 FixedArray::OffsetOfElementAt(0));
5504 if (is_load) { 5524 if (is_load) {
5505 Node* result = LoadFixedArrayElement(the_context, mapped_index, 0, 5525 Node* result = LoadFixedArrayElement(the_context, mapped_index, 0,
5506 INTPTR_PARAMETERS); 5526 INTPTR_PARAMETERS);
5507 Assert(WordNotEqual(result, TheHoleConstant())); 5527 CSA_ASSERT(WordNotEqual(result, TheHoleConstant()));
5508 var_result.Bind(result); 5528 var_result.Bind(result);
5509 } else { 5529 } else {
5510 StoreFixedArrayElement(the_context, mapped_index, value, 5530 StoreFixedArrayElement(the_context, mapped_index, value,
5511 UPDATE_WRITE_BARRIER, INTPTR_PARAMETERS); 5531 UPDATE_WRITE_BARRIER, INTPTR_PARAMETERS);
5512 } 5532 }
5513 Goto(&end); 5533 Goto(&end);
5514 } 5534 }
5515 5535
5516 Bind(&if_unmapped); 5536 Bind(&if_unmapped);
5517 { 5537 {
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
7361 7381
7362 GotoIf(IsStringInstanceType(instance_type), &return_string); 7382 GotoIf(IsStringInstanceType(instance_type), &return_string);
7363 7383
7364 #define SIMD128_BRANCH(TYPE, Type, type, lane_count, lane_type) \ 7384 #define SIMD128_BRANCH(TYPE, Type, type, lane_count, lane_type) \
7365 Label return_##type(this); \ 7385 Label return_##type(this); \
7366 Node* type##_map = HeapConstant(factory()->type##_map()); \ 7386 Node* type##_map = HeapConstant(factory()->type##_map()); \
7367 GotoIf(WordEqual(map, type##_map), &return_##type); 7387 GotoIf(WordEqual(map, type##_map), &return_##type);
7368 SIMD128_TYPES(SIMD128_BRANCH) 7388 SIMD128_TYPES(SIMD128_BRANCH)
7369 #undef SIMD128_BRANCH 7389 #undef SIMD128_BRANCH
7370 7390
7371 Assert(Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE))); 7391 CSA_ASSERT(Word32Equal(instance_type, Int32Constant(SYMBOL_TYPE)));
7372 result_var.Bind(HeapConstant(isolate()->factory()->symbol_string())); 7392 result_var.Bind(HeapConstant(isolate()->factory()->symbol_string()));
7373 Goto(&return_result); 7393 Goto(&return_result);
7374 7394
7375 Bind(&return_number); 7395 Bind(&return_number);
7376 { 7396 {
7377 result_var.Bind(HeapConstant(isolate()->factory()->number_string())); 7397 result_var.Bind(HeapConstant(isolate()->factory()->number_string()));
7378 Goto(&return_result); 7398 Goto(&return_result);
7379 } 7399 }
7380 7400
7381 Bind(&if_oddball); 7401 Bind(&if_oddball);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
7452 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable)); 7472 result.Bind(CallRuntime(Runtime::kInstanceOf, context, object, callable));
7453 Goto(&end); 7473 Goto(&end);
7454 } 7474 }
7455 7475
7456 Bind(&end); 7476 Bind(&end);
7457 return result.value(); 7477 return result.value();
7458 } 7478 }
7459 7479
7460 } // namespace internal 7480 } // namespace internal
7461 } // namespace v8 7481 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stub-assembler.h ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698