| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_MACRO_ASSEMBLER_H_ | 5 #ifndef V8_MACRO_ASSEMBLER_H_ |
| 6 #define V8_MACRO_ASSEMBLER_H_ | 6 #define V8_MACRO_ASSEMBLER_H_ |
| 7 | 7 |
| 8 | 8 |
| 9 // Helper types to make boolean flag easier to read at call-site. | 9 // Helper types to make boolean flag easier to read at call-site. |
| 10 enum InvokeFlag { | 10 enum InvokeFlag { |
| 11 CALL_FUNCTION, | 11 CALL_FUNCTION, |
| 12 JUMP_FUNCTION | 12 JUMP_FUNCTION |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 | 15 |
| 16 // Flags used for the AllocateInNewSpace functions. | 16 // Flags used for the AllocateInNewSpace functions. |
| 17 enum AllocationFlags { | 17 enum AllocationFlags { |
| 18 // No special flags. | 18 // No special flags. |
| 19 NO_ALLOCATION_FLAGS = 0, | 19 NO_ALLOCATION_FLAGS = 0, |
| 20 // Return the pointer to the allocated already tagged as a heap object. | 20 // Return the pointer to the allocated already tagged as a heap object. |
| 21 TAG_OBJECT = 1 << 0, | 21 TAG_OBJECT = 1 << 0, |
| 22 // The content of the result register already contains the allocation top in | 22 // The content of the result register already contains the allocation top in |
| 23 // new space. | 23 // new space. |
| 24 RESULT_CONTAINS_TOP = 1 << 1, | 24 RESULT_CONTAINS_TOP = 1 << 1, |
| 25 // Specify that the requested size of the space to allocate is specified in | 25 // Specify that the requested size of the space to allocate is specified in |
| 26 // words instead of bytes. | 26 // words instead of bytes. |
| 27 SIZE_IN_WORDS = 1 << 2, | 27 SIZE_IN_WORDS = 1 << 2, |
| 28 // Align the allocation to a multiple of kDoubleSize | 28 // Align the allocation to a multiple of kDoubleSize |
| 29 DOUBLE_ALIGNMENT = 1 << 3, | 29 DOUBLE_ALIGNMENT = 1 << 3, |
| 30 // Directly allocate in old space | 30 // Directly allocate in old pointer space |
| 31 PRETENURE = 1 << 4, | 31 PRETENURE_OLD_POINTER_SPACE = 1 << 4, |
| 32 // Directly allocate in old data space |
| 33 PRETENURE_OLD_DATA_SPACE = 1 << 5 |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 | 36 |
| 35 // Invalid depth in prototype chain. | 37 // Invalid depth in prototype chain. |
| 36 const int kInvalidProtoDepth = -1; | 38 const int kInvalidProtoDepth = -1; |
| 37 | 39 |
| 38 #if V8_TARGET_ARCH_IA32 | 40 #if V8_TARGET_ARCH_IA32 |
| 39 #include "src/assembler.h" | 41 #include "src/assembler.h" |
| 40 #include "src/ia32/assembler-ia32.h" | 42 #include "src/ia32/assembler-ia32.h" |
| 41 #include "src/ia32/assembler-ia32-inl.h" | 43 #include "src/ia32/assembler-ia32-inl.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 Comment(MacroAssembler*, const char*) {} | 244 Comment(MacroAssembler*, const char*) {} |
| 243 }; | 245 }; |
| 244 | 246 |
| 245 #endif // DEBUG | 247 #endif // DEBUG |
| 246 | 248 |
| 247 | 249 |
| 248 class AllocationUtils { | 250 class AllocationUtils { |
| 249 public: | 251 public: |
| 250 static ExternalReference GetAllocationTopReference( | 252 static ExternalReference GetAllocationTopReference( |
| 251 Isolate* isolate, AllocationFlags flags) { | 253 Isolate* isolate, AllocationFlags flags) { |
| 252 if ((flags & PRETENURE) != 0) { | 254 if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { |
| 253 return ExternalReference::old_space_allocation_top_address(isolate); | 255 return ExternalReference::old_pointer_space_allocation_top_address( |
| 256 isolate); |
| 257 } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { |
| 258 return ExternalReference::old_data_space_allocation_top_address(isolate); |
| 254 } | 259 } |
| 255 return ExternalReference::new_space_allocation_top_address(isolate); | 260 return ExternalReference::new_space_allocation_top_address(isolate); |
| 256 } | 261 } |
| 257 | 262 |
| 258 | 263 |
| 259 static ExternalReference GetAllocationLimitReference( | 264 static ExternalReference GetAllocationLimitReference( |
| 260 Isolate* isolate, AllocationFlags flags) { | 265 Isolate* isolate, AllocationFlags flags) { |
| 261 if ((flags & PRETENURE) != 0) { | 266 if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { |
| 262 return ExternalReference::old_space_allocation_limit_address(isolate); | 267 return ExternalReference::old_pointer_space_allocation_limit_address( |
| 268 isolate); |
| 269 } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { |
| 270 return ExternalReference::old_data_space_allocation_limit_address( |
| 271 isolate); |
| 263 } | 272 } |
| 264 return ExternalReference::new_space_allocation_limit_address(isolate); | 273 return ExternalReference::new_space_allocation_limit_address(isolate); |
| 265 } | 274 } |
| 266 }; | 275 }; |
| 267 | 276 |
| 268 | 277 |
| 269 } } // namespace v8::internal | 278 } } // namespace v8::internal |
| 270 | 279 |
| 271 #endif // V8_MACRO_ASSEMBLER_H_ | 280 #endif // V8_MACRO_ASSEMBLER_H_ |
| OLD | NEW |