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

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

Issue 571005: ARM native string addition. (Closed)
Patch Set: Fixed bug in cons-allocation and string detection. Created 10 years, 10 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/arm/macro-assembler-arm.h ('k') | src/ia32/codegen-ia32.h » ('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 991 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 // Set the map, length and hash field. 1002 // Set the map, length and hash field.
1003 LoadRoot(scratch1, Heap::kAsciiStringMapRootIndex); 1003 LoadRoot(scratch1, Heap::kAsciiStringMapRootIndex);
1004 mov(scratch1, Operand(Factory::ascii_string_map())); 1004 mov(scratch1, Operand(Factory::ascii_string_map()));
1005 str(length, FieldMemOperand(result, String::kLengthOffset)); 1005 str(length, FieldMemOperand(result, String::kLengthOffset));
1006 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset)); 1006 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset));
1007 mov(scratch2, Operand(String::kEmptyHashField)); 1007 mov(scratch2, Operand(String::kEmptyHashField));
1008 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset)); 1008 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset));
1009 } 1009 }
1010 1010
1011 1011
1012 void MacroAssembler::AllocateTwoByteConsString(Register result,
1013 Register length,
1014 Register scratch1,
1015 Register scratch2,
1016 Label* gc_required) {
1017 AllocateInNewSpace(ConsString::kSize / kPointerSize,
1018 result,
1019 scratch1,
1020 scratch2,
1021 gc_required,
1022 TAG_OBJECT);
1023 LoadRoot(scratch1, Heap::kConsStringMapRootIndex);
1024 mov(scratch2, Operand(String::kEmptyHashField));
1025 str(length, FieldMemOperand(result, String::kLengthOffset));
1026 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset));
1027 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset));
1028 }
1029
1030
1031 void MacroAssembler::AllocateAsciiConsString(Register result,
1032 Register length,
1033 Register scratch1,
1034 Register scratch2,
1035 Label* gc_required) {
1036 AllocateInNewSpace(ConsString::kSize / kPointerSize,
1037 result,
1038 scratch1,
1039 scratch2,
1040 gc_required,
1041 TAG_OBJECT);
1042 LoadRoot(scratch1, Heap::kConsAsciiStringMapRootIndex);
1043 mov(scratch2, Operand(String::kEmptyHashField));
1044 str(length, FieldMemOperand(result, String::kLengthOffset));
1045 str(scratch1, FieldMemOperand(result, HeapObject::kMapOffset));
1046 str(scratch2, FieldMemOperand(result, String::kHashFieldOffset));
1047 }
1048
1049
1012 void MacroAssembler::CompareObjectType(Register function, 1050 void MacroAssembler::CompareObjectType(Register function,
1013 Register map, 1051 Register map,
1014 Register type_reg, 1052 Register type_reg,
1015 InstanceType type) { 1053 InstanceType type) {
1016 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset)); 1054 ldr(map, FieldMemOperand(function, HeapObject::kMapOffset));
1017 CompareInstanceType(map, type_reg, type); 1055 CompareInstanceType(map, type_reg, type);
1018 } 1056 }
1019 1057
1020 1058
1021 void MacroAssembler::CompareInstanceType(Register map, 1059 void MacroAssembler::CompareInstanceType(Register map,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 bind(&done); 1110 bind(&done);
1073 } 1111 }
1074 1112
1075 1113
1076 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { 1114 void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
1077 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs 1115 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs
1078 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); 1116 Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond);
1079 } 1117 }
1080 1118
1081 1119
1120 void MacroAssembler::TailCallStub(CodeStub* stub, Condition cond) {
1121 ASSERT(allow_stub_calls()); // stub calls are not allowed in some stubs
1122 Jump(stub->GetCode(), RelocInfo::CODE_TARGET, cond);
1123 }
1124
1125
1082 void MacroAssembler::StubReturn(int argc) { 1126 void MacroAssembler::StubReturn(int argc) {
1083 ASSERT(argc >= 1 && generating_stub()); 1127 ASSERT(argc >= 1 && generating_stub());
1084 if (argc > 1) 1128 if (argc > 1) {
1085 add(sp, sp, Operand((argc - 1) * kPointerSize)); 1129 add(sp, sp, Operand((argc - 1) * kPointerSize));
1130 }
1086 Ret(); 1131 Ret();
1087 } 1132 }
1088 1133
1089 1134
1090 void MacroAssembler::IllegalOperation(int num_arguments) { 1135 void MacroAssembler::IllegalOperation(int num_arguments) {
1091 if (num_arguments > 0) { 1136 if (num_arguments > 0) {
1092 add(sp, sp, Operand(num_arguments * kPointerSize)); 1137 add(sp, sp, Operand(num_arguments * kPointerSize));
1093 } 1138 }
1094 LoadRoot(r0, Heap::kUndefinedValueRootIndex); 1139 LoadRoot(r0, Heap::kUndefinedValueRootIndex);
1095 } 1140 }
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1312 } 1357 }
1313 // The context may be an intermediate context, not a function context. 1358 // The context may be an intermediate context, not a function context.
1314 ldr(dst, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); 1359 ldr(dst, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX)));
1315 } else { // Slot is in the current function context. 1360 } else { // Slot is in the current function context.
1316 // The context may be an intermediate context, not a function context. 1361 // The context may be an intermediate context, not a function context.
1317 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::FCONTEXT_INDEX))); 1362 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::FCONTEXT_INDEX)));
1318 } 1363 }
1319 } 1364 }
1320 1365
1321 1366
1367 void MacroAssembler::JumpIfNotBothSmi(Register reg1,
1368 Register reg2,
1369 Label* on_not_both_smi) {
1370 ASSERT_EQ(0, kSmiTag);
1371 tst(reg1, Operand(kSmiTagMask));
1372 tst(reg2, Operand(kSmiTagMask), eq);
1373 b(ne, on_not_both_smi);
1374 }
1375
1376
1377 void MacroAssembler::JumpIfEitherSmi(Register reg1,
1378 Register reg2,
1379 Label* on_either_smi) {
1380 ASSERT_EQ(0, kSmiTag);
1381 tst(reg1, Operand(kSmiTagMask));
1382 tst(reg2, Operand(kSmiTagMask), ne);
1383 b(eq, on_either_smi);
1384 }
1385
1386
1322 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings( 1387 void MacroAssembler::JumpIfNonSmisNotBothSequentialAsciiStrings(
1323 Register first, 1388 Register first,
1324 Register second, 1389 Register second,
1325 Register scratch1, 1390 Register scratch1,
1326 Register scratch2, 1391 Register scratch2,
1327 Label* failure) { 1392 Label* failure) {
1328 // Test that both first and second are sequential ASCII strings. 1393 // Test that both first and second are sequential ASCII strings.
1329 // Assume that they are non-smis. 1394 // Assume that they are non-smis.
1330 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); 1395 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset));
1331 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); 1396 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1388 } 1453 }
1389 1454
1390 1455
1391 void CodePatcher::Emit(Address addr) { 1456 void CodePatcher::Emit(Address addr) {
1392 masm()->emit(reinterpret_cast<Instr>(addr)); 1457 masm()->emit(reinterpret_cast<Instr>(addr));
1393 } 1458 }
1394 #endif // ENABLE_DEBUGGER_SUPPORT 1459 #endif // ENABLE_DEBUGGER_SUPPORT
1395 1460
1396 1461
1397 } } // namespace v8::internal 1462 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/ia32/codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698