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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 1706013: Changing string length field type from int to SMI. It will make it be a regu... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // Save the state of all registers to the stack from the memory 417 // Save the state of all registers to the stack from the memory
418 // location. This is needed to allow nested break points. 418 // location. This is needed to allow nested break points.
419 if (mode == ExitFrame::MODE_DEBUG) { 419 if (mode == ExitFrame::MODE_DEBUG) {
420 // Use sp as base to push. 420 // Use sp as base to push.
421 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); 421 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved);
422 } 422 }
423 #endif 423 #endif
424 } 424 }
425 425
426 426
427 void MacroAssembler::InitializeNewString(Register string,
428 Register length,
429 Heap::RootListIndex map_index,
430 Register scratch1,
431 Register scratch2) {
432 mov(scratch1, Operand(length, LSL, kSmiTagSize));
433 LoadRoot(scratch2, map_index);
434 str(scratch1, FieldMemOperand(string, String::kLengthOffset));
435 mov(scratch1, Operand(String::kEmptyHashField));
436 str(scratch2, FieldMemOperand(string, HeapObject::kMapOffset));
437 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset));
438 }
439
440
427 int MacroAssembler::ActivationFrameAlignment() { 441 int MacroAssembler::ActivationFrameAlignment() {
428 #if defined(V8_HOST_ARCH_ARM) 442 #if defined(V8_HOST_ARCH_ARM)
429 // Running on the real platform. Use the alignment as mandated by the local 443 // Running on the real platform. Use the alignment as mandated by the local
430 // environment. 444 // environment.
431 // Note: This will break if we ever start generating snapshots on one ARM 445 // Note: This will break if we ever start generating snapshots on one ARM
432 // platform for another ARM platform with a different alignment. 446 // platform for another ARM platform with a different alignment.
433 return OS::ActivationFrameAlignment(); 447 return OS::ActivationFrameAlignment();
434 #else // defined(V8_HOST_ARCH_ARM) 448 #else // defined(V8_HOST_ARCH_ARM)
435 // If we are using the simulator then we should always align to the expected 449 // If we are using the simulator then we should always align to the expected
436 // alignment. As the simulator is used to generate snapshots we do not know 450 // alignment. As the simulator is used to generate snapshots we do not know
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1061
1048 // Allocate two-byte string in new space. 1062 // Allocate two-byte string in new space.
1049 AllocateInNewSpace(scratch1, 1063 AllocateInNewSpace(scratch1,
1050 result, 1064 result,
1051 scratch2, 1065 scratch2,
1052 scratch3, 1066 scratch3,
1053 gc_required, 1067 gc_required,
1054 TAG_OBJECT); 1068 TAG_OBJECT);
1055 1069
1056 // Set the map, length and hash field. 1070 // Set the map, length and hash field.
1057 LoadRoot(scratch1, Heap::kStringMapRootIndex); 1071 InitializeNewString(result,
1058 str(length, FieldMemOperand(result, String::kLengthOffset)); 1072 length,
1059 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); 1073 Heap::kStringMapRootIndex,
1060 mov(scratch2, Operand(String::kEmptyHashField)); 1074 scratch1,
1061 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); 1075 scratch2);
1062 } 1076 }
1063 1077
1064 1078
1065 void MacroAssembler::AllocateAsciiString(Register result, 1079 void MacroAssembler::AllocateAsciiString(Register result,
1066 Register length, 1080 Register length,
1067 Register scratch1, 1081 Register scratch1,
1068 Register scratch2, 1082 Register scratch2,
1069 Register scratch3, 1083 Register scratch3,
1070 Label* gc_required) { 1084 Label* gc_required) {
1071 // Calculate the number of bytes needed for the characters in the string while 1085 // Calculate the number of bytes needed for the characters in the string while
1072 // observing object alignment. 1086 // observing object alignment.
1073 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0); 1087 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0);
1074 ASSERT(kCharSize == 1); 1088 ASSERT(kCharSize == 1);
1075 add(scratch1, length, 1089 add(scratch1, length,
1076 Operand(kObjectAlignmentMask + SeqAsciiString::kHeaderSize)); 1090 Operand(kObjectAlignmentMask + SeqAsciiString::kHeaderSize));
1077 // AllocateInNewSpace expects the size in words, so we can round down 1091 // AllocateInNewSpace expects the size in words, so we can round down
1078 // to kObjectAlignment and divide by kPointerSize in the same shift. 1092 // to kObjectAlignment and divide by kPointerSize in the same shift.
1079 ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1); 1093 ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1);
1080 mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2)); 1094 mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2));
1081 1095
1082 // Allocate ASCII string in new space. 1096 // Allocate ASCII string in new space.
1083 AllocateInNewSpace(scratch1, 1097 AllocateInNewSpace(scratch1,
1084 result, 1098 result,
1085 scratch2, 1099 scratch2,
1086 scratch3, 1100 scratch3,
1087 gc_required, 1101 gc_required,
1088 TAG_OBJECT); 1102 TAG_OBJECT);
1089 1103
1090 // Set the map, length and hash field. 1104 // Set the map, length and hash field.
1091 LoadRoot(scratch1, Heap::kAsciiStringMapRootIndex); 1105 InitializeNewString(result,
1092 mov(scratch1, Operand(Factory::ascii_string_map())); 1106 length,
1093 str(length, FieldMemOperand(result, String::kLengthOffset)); 1107 Heap::kAsciiStringMapRootIndex,
1094 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); 1108 scratch1,
1095 mov(scratch2, Operand(String::kEmptyHashField)); 1109 scratch2);
1096 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset));
1097 } 1110 }
1098 1111
1099 1112
1100 void MacroAssembler::AllocateTwoByteConsString(Register result, 1113 void MacroAssembler::AllocateTwoByteConsString(Register result,
1101 Register length, 1114 Register length,
1102 Register scratch1, 1115 Register scratch1,
1103 Register scratch2, 1116 Register scratch2,
1104 Label* gc_required) { 1117 Label* gc_required) {
1105 AllocateInNewSpace(ConsString::kSize / kPointerSize, 1118 AllocateInNewSpace(ConsString::kSize / kPointerSize,
1106 result, 1119 result,
1107 scratch1, 1120 scratch1,
1108 scratch2, 1121 scratch2,
1109 gc_required, 1122 gc_required,
1110 TAG_OBJECT); 1123 TAG_OBJECT);
1111 LoadRoot(scratch1, Heap::kConsStringMapRootIndex); 1124
1112 mov(scratch2, Operand(String::kEmptyHashField)); 1125 InitializeNewString(result,
1113 str(length, FieldMemOperand(result, String::kLengthOffset)); 1126 length,
1114 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); 1127 Heap::kConsStringMapRootIndex,
1115 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); 1128 scratch1,
1129 scratch2);
1116 } 1130 }
1117 1131
1118 1132
1119 void MacroAssembler::AllocateAsciiConsString(Register result, 1133 void MacroAssembler::AllocateAsciiConsString(Register result,
1120 Register length, 1134 Register length,
1121 Register scratch1, 1135 Register scratch1,
1122 Register scratch2, 1136 Register scratch2,
1123 Label* gc_required) { 1137 Label* gc_required) {
1124 AllocateInNewSpace(ConsString::kSize / kPointerSize, 1138 AllocateInNewSpace(ConsString::kSize / kPointerSize,
1125 result, 1139 result,
1126 scratch1, 1140 scratch1,
1127 scratch2, 1141 scratch2,
1128 gc_required, 1142 gc_required,
1129 TAG_OBJECT); 1143 TAG_OBJECT);
1130 LoadRoot(scratch1, Heap::kConsAsciiStringMapRootIndex); 1144
1131 mov(scratch2, Operand(String::kEmptyHashField)); 1145 InitializeNewString(result,
1132 str(length, FieldMemOperand(result, String::kLengthOffset)); 1146 length,
1133 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); 1147 Heap::kConsAsciiStringMapRootIndex,
1134 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); 1148 scratch1,
1149 scratch2);
1135 } 1150 }
1136 1151
1137 1152
1138 void MacroAssembler::CompareObjectType(Register object, 1153 void MacroAssembler::CompareObjectType(Register object,
1139 Register map, 1154 Register map,
1140 Register type_reg, 1155 Register type_reg,
1141 InstanceType type) { 1156 InstanceType type) {
1142 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); 1157 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset));
1143 CompareInstanceType(map, type_reg, type); 1158 CompareInstanceType(map, type_reg, type);
1144 } 1159 }
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1695 } 1710 }
1696 1711
1697 1712
1698 void CodePatcher::Emit(Address addr) { 1713 void CodePatcher::Emit(Address addr) {
1699 masm()->emit(reinterpret_cast<Instr>(addr)); 1714 masm()->emit(reinterpret_cast<Instr>(addr));
1700 } 1715 }
1701 #endif // ENABLE_DEBUGGER_SUPPORT 1716 #endif // ENABLE_DEBUGGER_SUPPORT
1702 1717
1703 1718
1704 } } // namespace v8::internal 1719 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698