OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
11 #include "src/base/division-by-constant.h" | 11 #include "src/base/division-by-constant.h" |
12 #include "src/bootstrapper.h" | 12 #include "src/bootstrapper.h" |
13 #include "src/codegen.h" | 13 #include "src/codegen.h" |
14 #include "src/debug/debug.h" | 14 #include "src/debug/debug.h" |
15 #include "src/register-configuration.h" | 15 #include "src/register-configuration.h" |
16 #include "src/runtime/runtime.h" | 16 #include "src/runtime/runtime.h" |
17 | 17 |
18 #include "src/ppc/macro-assembler-ppc.h" | 18 #include "src/ppc/macro-assembler-ppc.h" |
19 | 19 |
20 namespace v8 { | 20 namespace v8 { |
21 namespace internal { | 21 namespace internal { |
22 | 22 |
23 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 23 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, |
| 24 CodeObjectRequired create_code_object) |
24 : Assembler(arg_isolate, buffer, size), | 25 : Assembler(arg_isolate, buffer, size), |
25 generating_stub_(false), | 26 generating_stub_(false), |
26 has_frame_(false) { | 27 has_frame_(false) { |
27 if (isolate() != NULL) { | 28 if (create_code_object == CodeObjectRequired::kYes) { |
28 code_object_ = | 29 code_object_ = |
29 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); | 30 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); |
30 } | 31 } |
31 } | 32 } |
32 | 33 |
33 | 34 |
34 void MacroAssembler::Jump(Register target) { | 35 void MacroAssembler::Jump(Register target) { |
35 mtctr(target); | 36 mtctr(target); |
36 bctr(); | 37 bctr(); |
37 } | 38 } |
(...skipping 4325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4363 | 4364 |
4364 return n_of_valid_regs != n_of_non_aliasing_regs; | 4365 return n_of_valid_regs != n_of_non_aliasing_regs; |
4365 } | 4366 } |
4366 #endif | 4367 #endif |
4367 | 4368 |
4368 | 4369 |
4369 CodePatcher::CodePatcher(byte* address, int instructions, | 4370 CodePatcher::CodePatcher(byte* address, int instructions, |
4370 FlushICache flush_cache) | 4371 FlushICache flush_cache) |
4371 : address_(address), | 4372 : address_(address), |
4372 size_(instructions * Assembler::kInstrSize), | 4373 size_(instructions * Assembler::kInstrSize), |
4373 masm_(NULL, address, size_ + Assembler::kGap), | 4374 masm_(NULL, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), |
4374 flush_cache_(flush_cache) { | 4375 flush_cache_(flush_cache) { |
4375 // Create a new macro assembler pointing to the address of the code to patch. | 4376 // Create a new macro assembler pointing to the address of the code to patch. |
4376 // The size is adjusted with kGap on order for the assembler to generate size | 4377 // The size is adjusted with kGap on order for the assembler to generate size |
4377 // bytes of instructions without failing with buffer size constraints. | 4378 // bytes of instructions without failing with buffer size constraints. |
4378 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 4379 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
4379 } | 4380 } |
4380 | 4381 |
4381 | 4382 |
4382 CodePatcher::~CodePatcher() { | 4383 CodePatcher::~CodePatcher() { |
4383 // Indicate that code has changed. | 4384 // Indicate that code has changed. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4428 } | 4429 } |
4429 if (mag.shift > 0) srawi(result, result, mag.shift); | 4430 if (mag.shift > 0) srawi(result, result, mag.shift); |
4430 ExtractBit(r0, dividend, 31); | 4431 ExtractBit(r0, dividend, 31); |
4431 add(result, result, r0); | 4432 add(result, result, r0); |
4432 } | 4433 } |
4433 | 4434 |
4434 } // namespace internal | 4435 } // namespace internal |
4435 } // namespace v8 | 4436 } // namespace v8 |
4436 | 4437 |
4437 #endif // V8_TARGET_ARCH_PPC | 4438 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |