Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 2732273003: Disentangle assembler from isolate. (Closed)
Patch Set: Address feedback. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/assembler-arm64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <limits.h> // For LONG_MIN, LONG_MAX. 5 #include <limits.h> // For LONG_MIN, LONG_MAX.
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/assembler-inl.h" 9 #include "src/assembler-inl.h"
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/base/utils/random-number-generator.h"
12 #include "src/bootstrapper.h" 13 #include "src/bootstrapper.h"
13 #include "src/codegen.h" 14 #include "src/codegen.h"
14 #include "src/counters.h" 15 #include "src/counters.h"
15 #include "src/debug/debug.h" 16 #include "src/debug/debug.h"
16 #include "src/objects-inl.h" 17 #include "src/objects-inl.h"
17 #include "src/register-configuration.h" 18 #include "src/register-configuration.h"
18 #include "src/runtime/runtime.h" 19 #include "src/runtime/runtime.h"
19 20
20 #include "src/arm/macro-assembler-arm.h" 21 #include "src/arm/macro-assembler-arm.h"
21 22
22 namespace v8 { 23 namespace v8 {
23 namespace internal { 24 namespace internal {
24 25
25 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size, 26 MacroAssembler::MacroAssembler(Isolate* isolate, void* buffer, int size,
26 CodeObjectRequired create_code_object) 27 CodeObjectRequired create_code_object)
27 : Assembler(arg_isolate, buffer, size), 28 : Assembler(isolate, buffer, size),
28 generating_stub_(false), 29 generating_stub_(false),
29 has_frame_(false) { 30 has_frame_(false),
31 isolate_(isolate),
32 jit_cookie_(0) {
33 if (FLAG_mask_constants_with_cookie) {
34 jit_cookie_ = isolate->random_number_generator()->NextInt();
35 }
30 if (create_code_object == CodeObjectRequired::kYes) { 36 if (create_code_object == CodeObjectRequired::kYes) {
31 code_object_ = 37 code_object_ =
32 Handle<Object>::New(isolate()->heap()->undefined_value(), isolate()); 38 Handle<Object>::New(isolate_->heap()->undefined_value(), isolate_);
33 } 39 }
34 } 40 }
35 41
36 42
37 void MacroAssembler::Jump(Register target, Condition cond) { 43 void MacroAssembler::Jump(Register target, Condition cond) {
38 bx(target, cond); 44 bx(target, cond);
39 } 45 }
40 46
41 47
42 void MacroAssembler::Jump(intptr_t target, RelocInfo::Mode rmode, 48 void MacroAssembler::Jump(intptr_t target, RelocInfo::Mode rmode,
(...skipping 3764 matching lines...) Expand 10 before | Expand all | Expand 10 after
3807 if (reg5.is_valid()) regs |= reg5.bit(); 3813 if (reg5.is_valid()) regs |= reg5.bit();
3808 if (reg6.is_valid()) regs |= reg6.bit(); 3814 if (reg6.is_valid()) regs |= reg6.bit();
3809 if (reg7.is_valid()) regs |= reg7.bit(); 3815 if (reg7.is_valid()) regs |= reg7.bit();
3810 if (reg8.is_valid()) regs |= reg8.bit(); 3816 if (reg8.is_valid()) regs |= reg8.bit();
3811 int n_of_non_aliasing_regs = NumRegs(regs); 3817 int n_of_non_aliasing_regs = NumRegs(regs);
3812 3818
3813 return n_of_valid_regs != n_of_non_aliasing_regs; 3819 return n_of_valid_regs != n_of_non_aliasing_regs;
3814 } 3820 }
3815 #endif 3821 #endif
3816 3822
3817
3818 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int instructions, 3823 CodePatcher::CodePatcher(Isolate* isolate, byte* address, int instructions,
3819 FlushICache flush_cache) 3824 FlushICache flush_cache)
3820 : address_(address), 3825 : address_(address),
3821 size_(instructions * Assembler::kInstrSize), 3826 size_(instructions * Assembler::kInstrSize),
3822 masm_(isolate, address, size_ + Assembler::kGap, CodeObjectRequired::kNo), 3827 masm_(isolate, address, size_ + Assembler::kGap, CodeObjectRequired::kNo),
3823 flush_cache_(flush_cache) { 3828 flush_cache_(flush_cache) {
3824 // Create a new macro assembler pointing to the address of the code to patch. 3829 // Create a new macro assembler pointing to the address of the code to patch.
3825 // The size is adjusted with kGap on order for the assembler to generate size 3830 // The size is adjusted with kGap on order for the assembler to generate size
3826 // bytes of instructions without failing with buffer size constraints. 3831 // bytes of instructions without failing with buffer size constraints.
3827 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 3832 DCHECK(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3880 } 3885 }
3881 } 3886 }
3882 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); 3887 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift));
3883 add(result, result, Operand(dividend, LSR, 31)); 3888 add(result, result, Operand(dividend, LSR, 31));
3884 } 3889 }
3885 3890
3886 } // namespace internal 3891 } // namespace internal
3887 } // namespace v8 3892 } // namespace v8
3888 3893
3889 #endif // V8_TARGET_ARCH_ARM 3894 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm64/assembler-arm64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698