| 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 15 matching lines...) Expand all Loading... |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 28 #ifndef V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| 29 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 29 #define V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| 30 | 30 |
| 31 #include "assembler.h" | 31 #include "assembler.h" |
| 32 | 32 |
| 33 namespace v8 { | 33 namespace v8 { |
| 34 namespace internal { | 34 namespace internal { |
| 35 | 35 |
| 36 // ---------------------------------------------------------------------------- |
| 37 // Static helper functions |
| 38 |
| 39 // Generate a MemOperand for loading a field from an object. |
| 40 static inline MemOperand FieldMemOperand(Register object, int offset) { |
| 41 return MemOperand(object, offset - kHeapObjectTag); |
| 42 } |
| 43 |
| 36 | 44 |
| 37 // Give alias names to registers | 45 // Give alias names to registers |
| 38 const Register cp = { 8 }; // JavaScript context pointer | 46 const Register cp = { 8 }; // JavaScript context pointer |
| 39 | 47 const Register roots = { 10 }; // Roots array pointer. |
| 40 | 48 |
| 41 enum InvokeJSFlags { | 49 enum InvokeJSFlags { |
| 42 CALL_JS, | 50 CALL_JS, |
| 43 JUMP_JS | 51 JUMP_JS |
| 44 }; | 52 }; |
| 45 | 53 |
| 46 | 54 |
| 47 // MacroAssembler implements a collection of frequently used macros. | 55 // MacroAssembler implements a collection of frequently used macros. |
| 48 class MacroAssembler: public Assembler { | 56 class MacroAssembler: public Assembler { |
| 49 public: | 57 public: |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 Register scratch2, | 210 Register scratch2, |
| 203 Label* gc_required, | 211 Label* gc_required, |
| 204 AllocationFlags flags); | 212 AllocationFlags flags); |
| 205 | 213 |
| 206 // Undo allocation in new space. The object passed and objects allocated after | 214 // Undo allocation in new space. The object passed and objects allocated after |
| 207 // it will no longer be allocated. The caller must make sure that no pointers | 215 // it will no longer be allocated. The caller must make sure that no pointers |
| 208 // are left to the object(s) no longer allocated as they would be invalid when | 216 // are left to the object(s) no longer allocated as they would be invalid when |
| 209 // allocation is undone. | 217 // allocation is undone. |
| 210 void UndoAllocationInNewSpace(Register object, Register scratch); | 218 void UndoAllocationInNewSpace(Register object, Register scratch); |
| 211 | 219 |
| 220 |
| 221 void AllocateTwoByteString(Register result, |
| 222 Register length, |
| 223 Register scratch1, |
| 224 Register scratch2, |
| 225 Register scratch3, |
| 226 Label* gc_required); |
| 227 void AllocateAsciiString(Register result, |
| 228 Register length, |
| 229 Register scratch1, |
| 230 Register scratch2, |
| 231 Register scratch3, |
| 232 Label* gc_required); |
| 233 |
| 234 |
| 212 // --------------------------------------------------------------------------- | 235 // --------------------------------------------------------------------------- |
| 213 // Support functions. | 236 // Support functions. |
| 214 | 237 |
| 215 // Try to get function prototype of a function and puts the value in | 238 // Try to get function prototype of a function and puts the value in |
| 216 // the result register. Checks that the function really is a | 239 // the result register. Checks that the function really is a |
| 217 // function and jumps to the miss label if the fast checks fail. The | 240 // function and jumps to the miss label if the fast checks fail. The |
| 218 // function register will be untouched; the other registers may be | 241 // function register will be untouched; the other registers may be |
| 219 // clobbered. | 242 // clobbered. |
| 220 void TryGetFunctionPrototype(Register function, | 243 void TryGetFunctionPrototype(Register function, |
| 221 Register result, | 244 Register result, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 236 | 259 |
| 237 // Compare instance type in a map. map contains a valid map object whose | 260 // Compare instance type in a map. map contains a valid map object whose |
| 238 // object type should be compared with the given type. This both | 261 // object type should be compared with the given type. This both |
| 239 // sets the flags and leaves the object type in the type_reg register. It | 262 // sets the flags and leaves the object type in the type_reg register. It |
| 240 // leaves the heap object in the heap_object register unless the heap_object | 263 // leaves the heap object in the heap_object register unless the heap_object |
| 241 // register is the same register as type_reg. | 264 // register is the same register as type_reg. |
| 242 void CompareInstanceType(Register map, | 265 void CompareInstanceType(Register map, |
| 243 Register type_reg, | 266 Register type_reg, |
| 244 InstanceType type); | 267 InstanceType type); |
| 245 | 268 |
| 269 |
| 270 // Load and check the instance type of an object for being a string. |
| 271 // Loads the type into the second argument register. |
| 272 // Returns a condition that will be enabled if the object was a string. |
| 273 Condition IsObjectStringType(Register obj, |
| 274 Register type) { |
| 275 ldr(type, FieldMemOperand(obj, HeapObject::kMapOffset)); |
| 276 ldrb(type, FieldMemOperand(type, Map::kInstanceTypeOffset)); |
| 277 tst(type, Operand(kIsNotStringMask)); |
| 278 ASSERT_EQ(0, kStringTag); |
| 279 return eq; |
| 280 } |
| 281 |
| 282 |
| 246 inline void BranchOnSmi(Register value, Label* smi_label) { | 283 inline void BranchOnSmi(Register value, Label* smi_label) { |
| 247 tst(value, Operand(kSmiTagMask)); | 284 tst(value, Operand(kSmiTagMask)); |
| 248 b(eq, smi_label); | 285 b(eq, smi_label); |
| 249 } | 286 } |
| 250 | 287 |
| 251 inline void BranchOnNotSmi(Register value, Label* not_smi_label) { | 288 inline void BranchOnNotSmi(Register value, Label* not_smi_label) { |
| 252 tst(value, Operand(kSmiTagMask)); | 289 tst(value, Operand(kSmiTagMask)); |
| 253 b(ne, not_smi_label); | 290 b(ne, not_smi_label); |
| 254 } | 291 } |
| 255 | 292 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 int instructions_; // Number of instructions of the expected patch size. | 451 int instructions_; // Number of instructions of the expected patch size. |
| 415 int size_; // Number of bytes of the expected patch size. | 452 int size_; // Number of bytes of the expected patch size. |
| 416 MacroAssembler masm_; // Macro assembler used to generate the code. | 453 MacroAssembler masm_; // Macro assembler used to generate the code. |
| 417 }; | 454 }; |
| 418 #endif // ENABLE_DEBUGGER_SUPPORT | 455 #endif // ENABLE_DEBUGGER_SUPPORT |
| 419 | 456 |
| 420 | 457 |
| 421 // ----------------------------------------------------------------------------- | 458 // ----------------------------------------------------------------------------- |
| 422 // Static helper functions. | 459 // Static helper functions. |
| 423 | 460 |
| 424 // Generate a MemOperand for loading a field from an object. | |
| 425 static inline MemOperand FieldMemOperand(Register object, int offset) { | |
| 426 return MemOperand(object, offset - kHeapObjectTag); | |
| 427 } | |
| 428 | |
| 429 | |
| 430 #ifdef GENERATED_CODE_COVERAGE | 461 #ifdef GENERATED_CODE_COVERAGE |
| 431 #define CODE_COVERAGE_STRINGIFY(x) #x | 462 #define CODE_COVERAGE_STRINGIFY(x) #x |
| 432 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) | 463 #define CODE_COVERAGE_TOSTRING(x) CODE_COVERAGE_STRINGIFY(x) |
| 433 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) | 464 #define __FILE_LINE__ __FILE__ ":" CODE_COVERAGE_TOSTRING(__LINE__) |
| 434 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> | 465 #define ACCESS_MASM(masm) masm->stop(__FILE_LINE__); masm-> |
| 435 #else | 466 #else |
| 436 #define ACCESS_MASM(masm) masm-> | 467 #define ACCESS_MASM(masm) masm-> |
| 437 #endif | 468 #endif |
| 438 | 469 |
| 439 | 470 |
| 440 } } // namespace v8::internal | 471 } } // namespace v8::internal |
| 441 | 472 |
| 442 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ | 473 #endif // V8_ARM_MACRO_ASSEMBLER_ARM_H_ |
| OLD | NEW |