| OLD | NEW |
| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Save the state of all registers to the stack from the memory | 392 // Save the state of all registers to the stack from the memory |
| 393 // location. This is needed to allow nested break points. | 393 // location. This is needed to allow nested break points. |
| 394 if (mode == ExitFrame::MODE_DEBUG) { | 394 if (mode == ExitFrame::MODE_DEBUG) { |
| 395 // Use sp as base to push. | 395 // Use sp as base to push. |
| 396 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); | 396 CopyRegistersFromMemoryToStack(sp, kJSCallerSaved); |
| 397 } | 397 } |
| 398 #endif | 398 #endif |
| 399 } | 399 } |
| 400 | 400 |
| 401 | 401 |
| 402 void MacroAssembler::InitializeNewString(Register string, | |
| 403 Register length, | |
| 404 Heap::RootListIndex map_index, | |
| 405 Register scratch1, | |
| 406 Register scratch2) { | |
| 407 mov(scratch1, Operand(length, LSL, kSmiTagSize)); | |
| 408 LoadRoot(scratch2, map_index); | |
| 409 str(scratch1, FieldMemOperand(string, String::kLengthOffset)); | |
| 410 mov(scratch1, Operand(String::kEmptyHashField)); | |
| 411 str(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); | |
| 412 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); | |
| 413 } | |
| 414 | |
| 415 | |
| 416 int MacroAssembler::ActivationFrameAlignment() { | 402 int MacroAssembler::ActivationFrameAlignment() { |
| 417 #if defined(V8_HOST_ARCH_ARM) | 403 #if defined(V8_HOST_ARCH_ARM) |
| 418 // Running on the real platform. Use the alignment as mandated by the local | 404 // Running on the real platform. Use the alignment as mandated by the local |
| 419 // environment. | 405 // environment. |
| 420 // Note: This will break if we ever start generating snapshots on one ARM | 406 // Note: This will break if we ever start generating snapshots on one ARM |
| 421 // platform for another ARM platform with a different alignment. | 407 // platform for another ARM platform with a different alignment. |
| 422 return OS::ActivationFrameAlignment(); | 408 return OS::ActivationFrameAlignment(); |
| 423 #else // defined(V8_HOST_ARCH_ARM) | 409 #else // defined(V8_HOST_ARCH_ARM) |
| 424 // If we are using the simulator then we should always align to the expected | 410 // If we are using the simulator then we should always align to the expected |
| 425 // alignment. As the simulator is used to generate snapshots we do not know | 411 // alignment. As the simulator is used to generate snapshots we do not know |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1027 | 1013 |
| 1028 // Allocate two-byte string in new space. | 1014 // Allocate two-byte string in new space. |
| 1029 AllocateInNewSpace(scratch1, | 1015 AllocateInNewSpace(scratch1, |
| 1030 result, | 1016 result, |
| 1031 scratch2, | 1017 scratch2, |
| 1032 scratch3, | 1018 scratch3, |
| 1033 gc_required, | 1019 gc_required, |
| 1034 TAG_OBJECT); | 1020 TAG_OBJECT); |
| 1035 | 1021 |
| 1036 // Set the map, length and hash field. | 1022 // Set the map, length and hash field. |
| 1037 InitializeNewString(result, | 1023 LoadRoot(scratch1, Heap::kStringMapRootIndex); |
| 1038 length, | 1024 str(length, FieldMemOperand(result, String::kLengthOffset)); |
| 1039 Heap::kStringMapRootIndex, | 1025 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 1040 scratch1, | 1026 mov(scratch2, Operand(String::kEmptyHashField)); |
| 1041 scratch2); | 1027 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); |
| 1042 } | 1028 } |
| 1043 | 1029 |
| 1044 | 1030 |
| 1045 void MacroAssembler::AllocateAsciiString(Register result, | 1031 void MacroAssembler::AllocateAsciiString(Register result, |
| 1046 Register length, | 1032 Register length, |
| 1047 Register scratch1, | 1033 Register scratch1, |
| 1048 Register scratch2, | 1034 Register scratch2, |
| 1049 Register scratch3, | 1035 Register scratch3, |
| 1050 Label* gc_required) { | 1036 Label* gc_required) { |
| 1051 // Calculate the number of bytes needed for the characters in the string while | 1037 // Calculate the number of bytes needed for the characters in the string while |
| 1052 // observing object alignment. | 1038 // observing object alignment. |
| 1053 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0); | 1039 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0); |
| 1054 ASSERT(kCharSize == 1); | 1040 ASSERT(kCharSize == 1); |
| 1055 add(scratch1, length, | 1041 add(scratch1, length, |
| 1056 Operand(kObjectAlignmentMask + SeqAsciiString::kHeaderSize)); | 1042 Operand(kObjectAlignmentMask + SeqAsciiString::kHeaderSize)); |
| 1057 // AllocateInNewSpace expects the size in words, so we can round down | 1043 // AllocateInNewSpace expects the size in words, so we can round down |
| 1058 // to kObjectAlignment and divide by kPointerSize in the same shift. | 1044 // to kObjectAlignment and divide by kPointerSize in the same shift. |
| 1059 ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1); | 1045 ASSERT_EQ(kPointerSize, kObjectAlignmentMask + 1); |
| 1060 mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2)); | 1046 mov(scratch1, Operand(scratch1, ASR, kPointerSizeLog2)); |
| 1061 | 1047 |
| 1062 // Allocate ASCII string in new space. | 1048 // Allocate ASCII string in new space. |
| 1063 AllocateInNewSpace(scratch1, | 1049 AllocateInNewSpace(scratch1, |
| 1064 result, | 1050 result, |
| 1065 scratch2, | 1051 scratch2, |
| 1066 scratch3, | 1052 scratch3, |
| 1067 gc_required, | 1053 gc_required, |
| 1068 TAG_OBJECT); | 1054 TAG_OBJECT); |
| 1069 | 1055 |
| 1070 // Set the map, length and hash field. | 1056 // Set the map, length and hash field. |
| 1071 InitializeNewString(result, | 1057 LoadRoot(scratch1, Heap::kAsciiStringMapRootIndex); |
| 1072 length, | 1058 mov(scratch1, Operand(Factory::ascii_string_map())); |
| 1073 Heap::kAsciiStringMapRootIndex, | 1059 str(length, FieldMemOperand(result, String::kLengthOffset)); |
| 1074 scratch1, | 1060 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 1075 scratch2); | 1061 mov(scratch2, Operand(String::kEmptyHashField)); |
| 1062 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); |
| 1076 } | 1063 } |
| 1077 | 1064 |
| 1078 | 1065 |
| 1079 void MacroAssembler::AllocateTwoByteConsString(Register result, | 1066 void MacroAssembler::AllocateTwoByteConsString(Register result, |
| 1080 Register length, | 1067 Register length, |
| 1081 Register scratch1, | 1068 Register scratch1, |
| 1082 Register scratch2, | 1069 Register scratch2, |
| 1083 Label* gc_required) { | 1070 Label* gc_required) { |
| 1084 AllocateInNewSpace(ConsString::kSize / kPointerSize, | 1071 AllocateInNewSpace(ConsString::kSize / kPointerSize, |
| 1085 result, | 1072 result, |
| 1086 scratch1, | 1073 scratch1, |
| 1087 scratch2, | 1074 scratch2, |
| 1088 gc_required, | 1075 gc_required, |
| 1089 TAG_OBJECT); | 1076 TAG_OBJECT); |
| 1090 | 1077 LoadRoot(scratch1, Heap::kConsStringMapRootIndex); |
| 1091 InitializeNewString(result, | 1078 mov(scratch2, Operand(String::kEmptyHashField)); |
| 1092 length, | 1079 str(length, FieldMemOperand(result, String::kLengthOffset)); |
| 1093 Heap::kConsStringMapRootIndex, | 1080 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 1094 scratch1, | 1081 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); |
| 1095 scratch2); | |
| 1096 } | 1082 } |
| 1097 | 1083 |
| 1098 | 1084 |
| 1099 void MacroAssembler::AllocateAsciiConsString(Register result, | 1085 void MacroAssembler::AllocateAsciiConsString(Register result, |
| 1100 Register length, | 1086 Register length, |
| 1101 Register scratch1, | 1087 Register scratch1, |
| 1102 Register scratch2, | 1088 Register scratch2, |
| 1103 Label* gc_required) { | 1089 Label* gc_required) { |
| 1104 AllocateInNewSpace(ConsString::kSize / kPointerSize, | 1090 AllocateInNewSpace(ConsString::kSize / kPointerSize, |
| 1105 result, | 1091 result, |
| 1106 scratch1, | 1092 scratch1, |
| 1107 scratch2, | 1093 scratch2, |
| 1108 gc_required, | 1094 gc_required, |
| 1109 TAG_OBJECT); | 1095 TAG_OBJECT); |
| 1110 | 1096 LoadRoot(scratch1, Heap::kConsAsciiStringMapRootIndex); |
| 1111 InitializeNewString(result, | 1097 mov(scratch2, Operand(String::kEmptyHashField)); |
| 1112 length, | 1098 str(length, FieldMemOperand(result, String::kLengthOffset)); |
| 1113 Heap::kConsAsciiStringMapRootIndex, | 1099 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); |
| 1114 scratch1, | 1100 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); |
| 1115 scratch2); | |
| 1116 } | 1101 } |
| 1117 | 1102 |
| 1118 | 1103 |
| 1119 void MacroAssembler::CompareObjectType(Register object, | 1104 void MacroAssembler::CompareObjectType(Register object, |
| 1120 Register map, | 1105 Register map, |
| 1121 Register type_reg, | 1106 Register type_reg, |
| 1122 InstanceType type) { | 1107 InstanceType type) { |
| 1123 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 1108 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
| 1124 CompareInstanceType(map, type_reg, type); | 1109 CompareInstanceType(map, type_reg, type); |
| 1125 } | 1110 } |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1676 } | 1661 } |
| 1677 | 1662 |
| 1678 | 1663 |
| 1679 void CodePatcher::Emit(Address addr) { | 1664 void CodePatcher::Emit(Address addr) { |
| 1680 masm()->emit(reinterpret_cast<Instr>(addr)); | 1665 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 1681 } | 1666 } |
| 1682 #endif // ENABLE_DEBUGGER_SUPPORT | 1667 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1683 | 1668 |
| 1684 | 1669 |
| 1685 } } // namespace v8::internal | 1670 } } // namespace v8::internal |
| OLD | NEW |