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 pointer space | 30 // Directly allocate in old space |
31 PRETENURE_OLD_POINTER_SPACE = 1 << 4, | 31 PRETENURE = 1 << 4, |
32 // Directly allocate in old data space | |
33 PRETENURE_OLD_DATA_SPACE = 1 << 5 | |
34 }; | 32 }; |
35 | 33 |
36 | 34 |
37 // Invalid depth in prototype chain. | 35 // Invalid depth in prototype chain. |
38 const int kInvalidProtoDepth = -1; | 36 const int kInvalidProtoDepth = -1; |
39 | 37 |
40 #if V8_TARGET_ARCH_IA32 | 38 #if V8_TARGET_ARCH_IA32 |
41 #include "src/assembler.h" | 39 #include "src/assembler.h" |
42 #include "src/ia32/assembler-ia32.h" | 40 #include "src/ia32/assembler-ia32.h" |
43 #include "src/ia32/assembler-ia32-inl.h" | 41 #include "src/ia32/assembler-ia32-inl.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 Comment(MacroAssembler*, const char*) {} | 242 Comment(MacroAssembler*, const char*) {} |
245 }; | 243 }; |
246 | 244 |
247 #endif // DEBUG | 245 #endif // DEBUG |
248 | 246 |
249 | 247 |
250 class AllocationUtils { | 248 class AllocationUtils { |
251 public: | 249 public: |
252 static ExternalReference GetAllocationTopReference( | 250 static ExternalReference GetAllocationTopReference( |
253 Isolate* isolate, AllocationFlags flags) { | 251 Isolate* isolate, AllocationFlags flags) { |
254 if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { | 252 if ((flags & PRETENURE) != 0) { |
255 return ExternalReference::old_pointer_space_allocation_top_address( | 253 return ExternalReference::old_space_allocation_top_address(isolate); |
256 isolate); | |
257 } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { | |
258 return ExternalReference::old_data_space_allocation_top_address(isolate); | |
259 } | 254 } |
260 return ExternalReference::new_space_allocation_top_address(isolate); | 255 return ExternalReference::new_space_allocation_top_address(isolate); |
261 } | 256 } |
262 | 257 |
263 | 258 |
264 static ExternalReference GetAllocationLimitReference( | 259 static ExternalReference GetAllocationLimitReference( |
265 Isolate* isolate, AllocationFlags flags) { | 260 Isolate* isolate, AllocationFlags flags) { |
266 if ((flags & PRETENURE_OLD_POINTER_SPACE) != 0) { | 261 if ((flags & PRETENURE) != 0) { |
267 return ExternalReference::old_pointer_space_allocation_limit_address( | 262 return ExternalReference::old_space_allocation_limit_address(isolate); |
268 isolate); | |
269 } else if ((flags & PRETENURE_OLD_DATA_SPACE) != 0) { | |
270 return ExternalReference::old_data_space_allocation_limit_address( | |
271 isolate); | |
272 } | 263 } |
273 return ExternalReference::new_space_allocation_limit_address(isolate); | 264 return ExternalReference::new_space_allocation_limit_address(isolate); |
274 } | 265 } |
275 }; | 266 }; |
276 | 267 |
277 | 268 |
278 } } // namespace v8::internal | 269 } } // namespace v8::internal |
279 | 270 |
280 #endif // V8_MACRO_ASSEMBLER_H_ | 271 #endif // V8_MACRO_ASSEMBLER_H_ |
OLD | NEW |