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

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

Issue 6727021: Fix compile failure on Win64. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Correctly use isolate() Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 MacroAssembler::MacroAssembler(void* buffer, int size) 43 MacroAssembler::MacroAssembler(void* buffer, int size)
44 : Assembler(buffer, size), 44 : Assembler(buffer, size),
45 generating_stub_(false), 45 generating_stub_(false),
46 allow_stub_calls_(true), 46 allow_stub_calls_(true),
47 root_array_available_(true), 47 root_array_available_(true),
48 code_object_(HEAP->undefined_value()) { 48 code_object_(HEAP->undefined_value()) {
49 } 49 }
50 50
51 51
52 static intptr_t RootRegisterDelta(ExternalReference other) { 52 static intptr_t RootRegisterDelta(ExternalReference other, Isolate* isolate) {
53 Address roots_register_value = kRootRegisterBias + 53 Address roots_register_value = kRootRegisterBias +
54 reinterpret_cast<Address>(Isolate::Current()->heap()->roots_address()); 54 reinterpret_cast<Address>(isolate->heap()->roots_address());
55 intptr_t delta = other.address() - roots_register_value; 55 intptr_t delta = other.address() - roots_register_value;
56 return delta; 56 return delta;
57 } 57 }
58 58
59 59
60 Operand MacroAssembler::ExternalOperand(ExternalReference target, 60 Operand MacroAssembler::ExternalOperand(ExternalReference target,
61 Register scratch) { 61 Register scratch) {
62 if (root_array_available_ && !Serializer::enabled()) { 62 if (root_array_available_ && !Serializer::enabled()) {
63 intptr_t delta = RootRegisterDelta(target); 63 intptr_t delta = RootRegisterDelta(target, isolate());
64 if (is_int32(delta)) { 64 if (is_int32(delta)) {
65 Serializer::TooLateToEnableNow(); 65 Serializer::TooLateToEnableNow();
66 return Operand(kRootRegister, delta); 66 return Operand(kRootRegister, static_cast<int32_t>(delta));
67 } 67 }
68 } 68 }
69 movq(scratch, target); 69 movq(scratch, target);
70 return Operand(scratch, 0); 70 return Operand(scratch, 0);
71 } 71 }
72 72
73 73
74 void MacroAssembler::Load(Register destination, ExternalReference source) { 74 void MacroAssembler::Load(Register destination, ExternalReference source) {
75 if (root_array_available_ && !Serializer::enabled()) { 75 if (root_array_available_ && !Serializer::enabled()) {
76 intptr_t delta = RootRegisterDelta(source); 76 intptr_t delta = RootRegisterDelta(source, isolate());
77 if (is_int32(delta)) { 77 if (is_int32(delta)) {
78 Serializer::TooLateToEnableNow(); 78 Serializer::TooLateToEnableNow();
79 movq(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); 79 movq(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
80 return; 80 return;
81 } 81 }
82 } 82 }
83 // Safe code. 83 // Safe code.
84 if (destination.is(rax)) { 84 if (destination.is(rax)) {
85 load_rax(source); 85 load_rax(source);
86 } else { 86 } else {
87 movq(kScratchRegister, source); 87 movq(kScratchRegister, source);
88 movq(destination, Operand(kScratchRegister, 0)); 88 movq(destination, Operand(kScratchRegister, 0));
89 } 89 }
90 } 90 }
91 91
92 92
93 void MacroAssembler::Store(ExternalReference destination, Register source) { 93 void MacroAssembler::Store(ExternalReference destination, Register source) {
94 if (root_array_available_ && !Serializer::enabled()) { 94 if (root_array_available_ && !Serializer::enabled()) {
95 intptr_t delta = RootRegisterDelta(destination); 95 intptr_t delta = RootRegisterDelta(destination, isolate());
96 if (is_int32(delta)) { 96 if (is_int32(delta)) {
97 Serializer::TooLateToEnableNow(); 97 Serializer::TooLateToEnableNow();
98 movq(Operand(kRootRegister, static_cast<int32_t>(delta)), source); 98 movq(Operand(kRootRegister, static_cast<int32_t>(delta)), source);
99 return; 99 return;
100 } 100 }
101 } 101 }
102 // Safe code. 102 // Safe code.
103 if (source.is(rax)) { 103 if (source.is(rax)) {
104 store_rax(destination); 104 store_rax(destination);
105 } else { 105 } else {
106 movq(kScratchRegister, destination); 106 movq(kScratchRegister, destination);
107 movq(Operand(kScratchRegister, 0), source); 107 movq(Operand(kScratchRegister, 0), source);
108 } 108 }
109 } 109 }
110 110
111 111
112 void MacroAssembler::LoadAddress(Register destination, 112 void MacroAssembler::LoadAddress(Register destination,
113 ExternalReference source) { 113 ExternalReference source) {
114 if (root_array_available_ && !Serializer::enabled()) { 114 if (root_array_available_ && !Serializer::enabled()) {
115 intptr_t delta = RootRegisterDelta(source); 115 intptr_t delta = RootRegisterDelta(source, isolate());
116 if (is_int32(delta)) { 116 if (is_int32(delta)) {
117 Serializer::TooLateToEnableNow(); 117 Serializer::TooLateToEnableNow();
118 lea(destination, Operand(kRootRegister, static_cast<int32_t>(delta))); 118 lea(destination, Operand(kRootRegister, static_cast<int32_t>(delta)));
119 return; 119 return;
120 } 120 }
121 } 121 }
122 // Safe code. 122 // Safe code.
123 movq(destination, source); 123 movq(destination, source);
124 } 124 }
125 125
126 126
127 int MacroAssembler::LoadAddressSize(ExternalReference source) { 127 int MacroAssembler::LoadAddressSize(ExternalReference source) {
128 if (root_array_available_ && !Serializer::enabled()) { 128 if (root_array_available_ && !Serializer::enabled()) {
129 // This calculation depends on the internals of LoadAddress. 129 // This calculation depends on the internals of LoadAddress.
130 // It's correctness is ensured by the asserts in the Call 130 // It's correctness is ensured by the asserts in the Call
131 // instruction below. 131 // instruction below.
132 intptr_t delta = RootRegisterDelta(source); 132 intptr_t delta = RootRegisterDelta(source, isolate());
133 if (is_int32(delta)) { 133 if (is_int32(delta)) {
134 Serializer::TooLateToEnableNow(); 134 Serializer::TooLateToEnableNow();
135 // Operand is lea(scratch, Operand(kRootRegister, delta)); 135 // Operand is lea(scratch, Operand(kRootRegister, delta));
136 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7. 136 // Opcodes : REX.W 8D ModRM Disp8/Disp32 - 4 or 7.
137 int size = 4; 137 int size = 4;
138 if (!is_int8(static_cast<int32_t>(delta))) { 138 if (!is_int8(static_cast<int32_t>(delta))) {
139 size += 3; // Need full four-byte displacement in lea. 139 size += 3; // Need full four-byte displacement in lea.
140 } 140 }
141 return size; 141 return size;
142 } 142 }
(...skipping 2714 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 CPU::FlushICache(address_, size_); 2857 CPU::FlushICache(address_, size_);
2858 2858
2859 // Check that the code was patched as expected. 2859 // Check that the code was patched as expected.
2860 ASSERT(masm_.pc_ == address_ + size_); 2860 ASSERT(masm_.pc_ == address_ + size_);
2861 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2861 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2862 } 2862 }
2863 2863
2864 } } // namespace v8::internal 2864 } } // namespace v8::internal
2865 2865
2866 #endif // V8_TARGET_ARCH_X64 2866 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698