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

Side by Side Diff: src/x87/codegen-x87.cc

Issue 1480883002: Initialize fast memmove methods in the Isolate's ctor (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/v8.cc ('k') | 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 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 "src/x87/codegen-x87.h" 5 #include "src/x87/codegen-x87.h"
6 6
7 #if V8_TARGET_ARCH_X87 7 #if V8_TARGET_ARCH_X87
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/heap/heap.h" 10 #include "src/heap/heap.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 public: 87 public:
88 explicit LabelConverter(byte* buffer) : buffer_(buffer) {} 88 explicit LabelConverter(byte* buffer) : buffer_(buffer) {}
89 int32_t address(Label* l) const { 89 int32_t address(Label* l) const {
90 return reinterpret_cast<int32_t>(buffer_) + l->pos(); 90 return reinterpret_cast<int32_t>(buffer_) + l->pos();
91 } 91 }
92 private: 92 private:
93 byte* buffer_; 93 byte* buffer_;
94 }; 94 };
95 95
96 96
97 MemMoveFunction CreateMemMoveFunction() { 97 MemMoveFunction CreateMemMoveFunction(Isolate* isolate) {
98 size_t actual_size; 98 size_t actual_size;
99 // Allocate buffer in executable space. 99 // Allocate buffer in executable space.
100 byte* buffer = 100 byte* buffer =
101 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true)); 101 static_cast<byte*>(base::OS::Allocate(1 * KB, &actual_size, true));
102 if (buffer == NULL) return NULL; 102 if (buffer == nullptr) return nullptr;
103 MacroAssembler masm(NULL, buffer, static_cast<int>(actual_size), 103 MacroAssembler masm(isolate, buffer, static_cast<int>(actual_size),
104 CodeObjectRequired::kNo); 104 CodeObjectRequired::kNo);
105 LabelConverter conv(buffer); 105 LabelConverter conv(buffer);
106 106
107 // Generated code is put into a fixed, unmovable buffer, and not into 107 // Generated code is put into a fixed, unmovable buffer, and not into
108 // the V8 heap. We can't, and don't, refer to any relocatable addresses 108 // the V8 heap. We can't, and don't, refer to any relocatable addresses
109 // (e.g. the JavaScript nan-object). 109 // (e.g. the JavaScript nan-object).
110 110
111 // 32-bit C declaration function calls pass arguments on stack. 111 // 32-bit C declaration function calls pass arguments on stack.
112 112
113 // Stack layout: 113 // Stack layout:
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 __ mov_b(Operand(dst, 0), eax); 194 __ mov_b(Operand(dst, 0), eax);
195 __ jmp(&backward_loop_1byte); 195 __ jmp(&backward_loop_1byte);
196 } 196 }
197 197
198 __ bind(&pop_and_return); 198 __ bind(&pop_and_return);
199 MemMoveEmitPopAndReturn(&masm); 199 MemMoveEmitPopAndReturn(&masm);
200 200
201 CodeDesc desc; 201 CodeDesc desc;
202 masm.GetCode(&desc); 202 masm.GetCode(&desc);
203 DCHECK(!RelocInfo::RequiresRelocation(desc)); 203 DCHECK(!RelocInfo::RequiresRelocation(desc));
204 Assembler::FlushICacheWithoutIsolate(buffer, actual_size); 204 Assembler::FlushICache(isolate, buffer, actual_size);
205 base::OS::ProtectCode(buffer, actual_size); 205 base::OS::ProtectCode(buffer, actual_size);
206 // TODO(jkummerow): It would be nice to register this code creation event 206 // TODO(jkummerow): It would be nice to register this code creation event
207 // with the PROFILE / GDBJIT system. 207 // with the PROFILE / GDBJIT system.
208 return FUNCTION_CAST<MemMoveFunction>(buffer); 208 return FUNCTION_CAST<MemMoveFunction>(buffer);
209 } 209 }
210 210
211 211
212 #undef __ 212 #undef __
213 213
214 // ------------------------------------------------------------------------- 214 // -------------------------------------------------------------------------
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 CodePatcher patcher(sequence, young_length); 643 CodePatcher patcher(sequence, young_length);
644 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32); 644 patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32);
645 } 645 }
646 } 646 }
647 647
648 648
649 } // namespace internal 649 } // namespace internal
650 } // namespace v8 650 } // namespace v8
651 651
652 #endif // V8_TARGET_ARCH_X87 652 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/v8.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698