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

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

Issue 460109: Perform string add in generated code on X64 platform... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 int3(); 303 int3();
304 } 304 }
305 305
306 306
307 void MacroAssembler::CallStub(CodeStub* stub) { 307 void MacroAssembler::CallStub(CodeStub* stub) {
308 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs 308 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
309 Call(stub->GetCode(), RelocInfo::CODE_TARGET); 309 Call(stub->GetCode(), RelocInfo::CODE_TARGET);
310 } 310 }
311 311
312 312
313 void MacroAssembler::TailCallStub(CodeStub* stub) {
314 ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
315 Jump(stub->GetCode(), RelocInfo::CODE_TARGET);
316 }
317
318
313 void MacroAssembler::StubReturn(int argc) { 319 void MacroAssembler::StubReturn(int argc) {
314 ASSERT(argc >= 1 && generating_stub()); 320 ASSERT(argc >= 1 && generating_stub());
315 ret((argc - 1) * kPointerSize); 321 ret((argc - 1) * kPointerSize);
316 } 322 }
317 323
318 324
319 void MacroAssembler::IllegalOperation(int num_arguments) { 325 void MacroAssembler::IllegalOperation(int num_arguments) {
320 if (num_arguments > 0) { 326 if (num_arguments > 0) {
321 addq(rsp, Immediate(num_arguments * kPointerSize)); 327 addq(rsp, Immediate(num_arguments * kPointerSize));
322 } 328 }
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 no_reg, 2243 no_reg,
2238 gc_required, 2244 gc_required,
2239 TAG_OBJECT); 2245 TAG_OBJECT);
2240 2246
2241 // Set the map. 2247 // Set the map.
2242 LoadRoot(kScratchRegister, Heap::kHeapNumberMapRootIndex); 2248 LoadRoot(kScratchRegister, Heap::kHeapNumberMapRootIndex);
2243 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister); 2249 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2244 } 2250 }
2245 2251
2246 2252
2253 void MacroAssembler::AllocateTwoByteString(Register result,
2254 Register length,
2255 Register scratch1,
2256 Register scratch2,
2257 Register scratch3,
2258 Label* gc_required) {
2259 // Calculate the number of bytes needed for the characters in the string while
2260 // observing object alignment.
2261 ASSERT((SeqTwoByteString::kHeaderSize & kObjectAlignmentMask) == 0);
2262 ASSERT(kShortSize == 2);
2263 // scratch1 = length * 2 + kObjectAlignmentMask.
2264 lea(scratch1, Operand(length, length, times_1, kObjectAlignmentMask));
2265 and_(scratch1, Immediate(~kObjectAlignmentMask));
2266
2267 // Allocate two byte string in new space.
2268 AllocateInNewSpace(SeqTwoByteString::kHeaderSize,
2269 times_1,
2270 scratch1,
2271 result,
2272 scratch2,
2273 scratch3,
2274 gc_required,
2275 TAG_OBJECT);
2276
2277 // Set the map, length and hash field.
2278 LoadRoot(kScratchRegister, Heap::kStringMapRootIndex);
2279 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2280 movl(FieldOperand(result, String::kLengthOffset), length);
2281 movl(FieldOperand(result, String::kHashFieldOffset),
2282 Immediate(String::kEmptyHashField));
2283 }
2284
2285
2286 void MacroAssembler::AllocateAsciiString(Register result,
2287 Register length,
2288 Register scratch1,
2289 Register scratch2,
2290 Register scratch3,
2291 Label* gc_required) {
2292 // Calculate the number of bytes needed for the characters in the string while
2293 // observing object alignment.
2294 ASSERT((SeqAsciiString::kHeaderSize & kObjectAlignmentMask) == 0);
2295 movl(scratch1, length);
2296 ASSERT(kCharSize == 1);
2297 addq(scratch1, Immediate(kObjectAlignmentMask));
2298 and_(scratch1, Immediate(~kObjectAlignmentMask));
2299
2300 // Allocate ascii string in new space.
2301 AllocateInNewSpace(SeqAsciiString::kHeaderSize,
2302 times_1,
2303 scratch1,
2304 result,
2305 scratch2,
2306 scratch3,
2307 gc_required,
2308 TAG_OBJECT);
2309
2310 // Set the map, length and hash field.
2311 LoadRoot(kScratchRegister, Heap::kAsciiStringMapRootIndex);
2312 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2313 movl(FieldOperand(result, String::kLengthOffset), length);
2314 movl(FieldOperand(result, String::kHashFieldOffset),
2315 Immediate(String::kEmptyHashField));
2316 }
2317
2318
2319 void MacroAssembler::AllocateConsString(Register result,
2320 Register scratch1,
2321 Register scratch2,
2322 Label* gc_required) {
2323 // Allocate heap number in new space.
2324 AllocateInNewSpace(ConsString::kSize,
2325 result,
2326 scratch1,
2327 scratch2,
2328 gc_required,
2329 TAG_OBJECT);
2330
2331 // Set the map. The other fields are left uninitialized.
2332 LoadRoot(kScratchRegister, Heap::kConsStringMapRootIndex);
2333 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2334 }
2335
2336
2337 void MacroAssembler::AllocateAsciiConsString(Register result,
2338 Register scratch1,
2339 Register scratch2,
2340 Label* gc_required) {
2341 // Allocate heap number in new space.
2342 AllocateInNewSpace(ConsString::kSize,
2343 result,
2344 scratch1,
2345 scratch2,
2346 gc_required,
2347 TAG_OBJECT);
2348
2349 // Set the map. The other fields are left uninitialized.
2350 LoadRoot(kScratchRegister, Heap::kConsAsciiStringMapRootIndex);
2351 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2352 }
2353
2354
2247 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { 2355 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2248 if (context_chain_length > 0) { 2356 if (context_chain_length > 0) {
2249 // Move up the chain of contexts to the context containing the slot. 2357 // Move up the chain of contexts to the context containing the slot.
2250 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX))); 2358 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX)));
2251 // Load the function context (which is the incoming, outer context). 2359 // Load the function context (which is the incoming, outer context).
2252 movq(rax, FieldOperand(rax, JSFunction::kContextOffset)); 2360 movq(rax, FieldOperand(rax, JSFunction::kContextOffset));
2253 for (int i = 1; i < context_chain_length; i++) { 2361 for (int i = 1; i < context_chain_length; i++) {
2254 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); 2362 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX)));
2255 movq(dst, FieldOperand(dst, JSFunction::kContextOffset)); 2363 movq(dst, FieldOperand(dst, JSFunction::kContextOffset));
2256 } 2364 }
(...skipping 18 matching lines...) Expand all
2275 CodePatcher::~CodePatcher() { 2383 CodePatcher::~CodePatcher() {
2276 // Indicate that code has changed. 2384 // Indicate that code has changed.
2277 CPU::FlushICache(address_, size_); 2385 CPU::FlushICache(address_, size_);
2278 2386
2279 // Check that the code was patched as expected. 2387 // Check that the code was patched as expected.
2280 ASSERT(masm_.pc_ == address_ + size_); 2388 ASSERT(masm_.pc_ == address_ + size_);
2281 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2389 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2282 } 2390 }
2283 2391
2284 } } // namespace v8::internal 2392 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698