| 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 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 void MacroAssembler::CallExternalReference(const ExternalReference& ext, | 1227 void MacroAssembler::CallExternalReference(const ExternalReference& ext, |
| 1228 int num_arguments) { | 1228 int num_arguments) { |
| 1229 mov(r0, Operand(num_arguments)); | 1229 mov(r0, Operand(num_arguments)); |
| 1230 mov(r1, Operand(ext)); | 1230 mov(r1, Operand(ext)); |
| 1231 | 1231 |
| 1232 CEntryStub stub(1); | 1232 CEntryStub stub(1); |
| 1233 CallStub(&stub); | 1233 CallStub(&stub); |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 | 1236 |
| 1237 void MacroAssembler::TailCallRuntime(const ExternalReference& ext, | 1237 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, |
| 1238 int num_arguments, | 1238 int num_arguments, |
| 1239 int result_size) { | 1239 int result_size) { |
| 1240 // TODO(1236192): Most runtime routines don't need the number of | 1240 // TODO(1236192): Most runtime routines don't need the number of |
| 1241 // arguments passed in because it is constant. At some point we | 1241 // arguments passed in because it is constant. At some point we |
| 1242 // should remove this need and make the runtime routine entry code | 1242 // should remove this need and make the runtime routine entry code |
| 1243 // smarter. | 1243 // smarter. |
| 1244 mov(r0, Operand(num_arguments)); | 1244 mov(r0, Operand(num_arguments)); |
| 1245 JumpToRuntime(ext); | 1245 JumpToExternalReference(ext); |
| 1246 } | 1246 } |
| 1247 | 1247 |
| 1248 | 1248 |
| 1249 void MacroAssembler::JumpToRuntime(const ExternalReference& builtin) { | 1249 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, |
| 1250 int num_arguments, |
| 1251 int result_size) { |
| 1252 TailCallExternalReference(ExternalReference(fid), num_arguments, result_size); |
| 1253 } |
| 1254 |
| 1255 |
| 1256 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin) { |
| 1250 #if defined(__thumb__) | 1257 #if defined(__thumb__) |
| 1251 // Thumb mode builtin. | 1258 // Thumb mode builtin. |
| 1252 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); | 1259 ASSERT((reinterpret_cast<intptr_t>(builtin.address()) & 1) == 1); |
| 1253 #endif | 1260 #endif |
| 1254 mov(r1, Operand(builtin)); | 1261 mov(r1, Operand(builtin)); |
| 1255 CEntryStub stub(1); | 1262 CEntryStub stub(1); |
| 1256 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); | 1263 Jump(stub.GetCode(), RelocInfo::CODE_TARGET); |
| 1257 } | 1264 } |
| 1258 | 1265 |
| 1259 | 1266 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 Register second, | 1410 Register second, |
| 1404 Register scratch1, | 1411 Register scratch1, |
| 1405 Register scratch2, | 1412 Register scratch2, |
| 1406 Label* failure) { | 1413 Label* failure) { |
| 1407 // Test that both first and second are sequential ASCII strings. | 1414 // Test that both first and second are sequential ASCII strings. |
| 1408 // Assume that they are non-smis. | 1415 // Assume that they are non-smis. |
| 1409 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); | 1416 ldr(scratch1, FieldMemOperand(first, HeapObject::kMapOffset)); |
| 1410 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); | 1417 ldr(scratch2, FieldMemOperand(second, HeapObject::kMapOffset)); |
| 1411 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); | 1418 ldrb(scratch1, FieldMemOperand(scratch1, Map::kInstanceTypeOffset)); |
| 1412 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); | 1419 ldrb(scratch2, FieldMemOperand(scratch2, Map::kInstanceTypeOffset)); |
| 1413 int kFlatAsciiStringMask = | 1420 |
| 1414 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; | 1421 JumpIfBothInstanceTypesAreNotSequentialAscii(scratch1, |
| 1415 int kFlatAsciiStringTag = ASCII_STRING_TYPE; | 1422 scratch2, |
| 1416 and_(scratch1, scratch1, Operand(kFlatAsciiStringMask)); | 1423 scratch1, |
| 1417 and_(scratch2, scratch2, Operand(kFlatAsciiStringMask)); | 1424 scratch2, |
| 1418 cmp(scratch1, Operand(kFlatAsciiStringTag)); | 1425 failure); |
| 1419 // Ignore second test if first test failed. | |
| 1420 cmp(scratch2, Operand(kFlatAsciiStringTag), eq); | |
| 1421 b(ne, failure); | |
| 1422 } | 1426 } |
| 1423 | 1427 |
| 1424 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, | 1428 void MacroAssembler::JumpIfNotBothSequentialAsciiStrings(Register first, |
| 1425 Register second, | 1429 Register second, |
| 1426 Register scratch1, | 1430 Register scratch1, |
| 1427 Register scratch2, | 1431 Register scratch2, |
| 1428 Label* failure) { | 1432 Label* failure) { |
| 1429 // Check that neither is a smi. | 1433 // Check that neither is a smi. |
| 1430 ASSERT_EQ(0, kSmiTag); | 1434 ASSERT_EQ(0, kSmiTag); |
| 1431 and_(scratch1, first, Operand(second)); | 1435 and_(scratch1, first, Operand(second)); |
| 1432 tst(scratch1, Operand(kSmiTagMask)); | 1436 tst(scratch1, Operand(kSmiTagMask)); |
| 1433 b(eq, failure); | 1437 b(eq, failure); |
| 1434 JumpIfNonSmisNotBothSequentialAsciiStrings(first, | 1438 JumpIfNonSmisNotBothSequentialAsciiStrings(first, |
| 1435 second, | 1439 second, |
| 1436 scratch1, | 1440 scratch1, |
| 1437 scratch2, | 1441 scratch2, |
| 1438 failure); | 1442 failure); |
| 1439 } | 1443 } |
| 1440 | 1444 |
| 1441 | 1445 |
| 1446 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii( |
| 1447 Register first, |
| 1448 Register second, |
| 1449 Register scratch1, |
| 1450 Register scratch2, |
| 1451 Label* failure) { |
| 1452 int kFlatAsciiStringMask = |
| 1453 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 1454 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 1455 and_(scratch1, first, Operand(kFlatAsciiStringMask)); |
| 1456 and_(scratch2, second, Operand(kFlatAsciiStringMask)); |
| 1457 cmp(scratch1, Operand(kFlatAsciiStringTag)); |
| 1458 // Ignore second test if first test failed. |
| 1459 cmp(scratch2, Operand(kFlatAsciiStringTag), eq); |
| 1460 b(ne, failure); |
| 1461 } |
| 1462 |
| 1463 |
| 1464 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(Register type, |
| 1465 Register scratch, |
| 1466 Label* failure) { |
| 1467 int kFlatAsciiStringMask = |
| 1468 kIsNotStringMask | kStringEncodingMask | kStringRepresentationMask; |
| 1469 int kFlatAsciiStringTag = ASCII_STRING_TYPE; |
| 1470 and_(scratch, type, Operand(kFlatAsciiStringMask)); |
| 1471 cmp(scratch, Operand(kFlatAsciiStringTag)); |
| 1472 b(ne, failure); |
| 1473 } |
| 1474 |
| 1475 |
| 1442 #ifdef ENABLE_DEBUGGER_SUPPORT | 1476 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1443 CodePatcher::CodePatcher(byte* address, int instructions) | 1477 CodePatcher::CodePatcher(byte* address, int instructions) |
| 1444 : address_(address), | 1478 : address_(address), |
| 1445 instructions_(instructions), | 1479 instructions_(instructions), |
| 1446 size_(instructions * Assembler::kInstrSize), | 1480 size_(instructions * Assembler::kInstrSize), |
| 1447 masm_(address, size_ + Assembler::kGap) { | 1481 masm_(address, size_ + Assembler::kGap) { |
| 1448 // Create a new macro assembler pointing to the address of the code to patch. | 1482 // Create a new macro assembler pointing to the address of the code to patch. |
| 1449 // The size is adjusted with kGap on order for the assembler to generate size | 1483 // The size is adjusted with kGap on order for the assembler to generate size |
| 1450 // bytes of instructions without failing with buffer size constraints. | 1484 // bytes of instructions without failing with buffer size constraints. |
| 1451 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1485 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1467 } | 1501 } |
| 1468 | 1502 |
| 1469 | 1503 |
| 1470 void CodePatcher::Emit(Address addr) { | 1504 void CodePatcher::Emit(Address addr) { |
| 1471 masm()->emit(reinterpret_cast<Instr>(addr)); | 1505 masm()->emit(reinterpret_cast<Instr>(addr)); |
| 1472 } | 1506 } |
| 1473 #endif // ENABLE_DEBUGGER_SUPPORT | 1507 #endif // ENABLE_DEBUGGER_SUPPORT |
| 1474 | 1508 |
| 1475 | 1509 |
| 1476 } } // namespace v8::internal | 1510 } } // namespace v8::internal |
| OLD | NEW |