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

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

Issue 844006: Merge changes up to V8 version 2.1.3 into the partial snapshots (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/partial_snapshots/
Patch Set: Created 10 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 | « src/x64/macro-assembler-x64.h ('k') | src/x64/regexp-macro-assembler-x64.cc » ('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 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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 void MacroAssembler::CallExternalReference(const ExternalReference& ext, 389 void MacroAssembler::CallExternalReference(const ExternalReference& ext,
390 int num_arguments) { 390 int num_arguments) {
391 movq(rax, Immediate(num_arguments)); 391 movq(rax, Immediate(num_arguments));
392 movq(rbx, ext); 392 movq(rbx, ext);
393 393
394 CEntryStub stub(1); 394 CEntryStub stub(1);
395 CallStub(&stub); 395 CallStub(&stub);
396 } 396 }
397 397
398 398
399 void MacroAssembler::TailCallRuntime(ExternalReference const& ext, 399 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext,
400 int num_arguments, 400 int num_arguments,
401 int result_size) { 401 int result_size) {
402 // ----------- S t a t e ------------- 402 // ----------- S t a t e -------------
403 // -- rsp[0] : return address 403 // -- rsp[0] : return address
404 // -- rsp[8] : argument num_arguments - 1 404 // -- rsp[8] : argument num_arguments - 1
405 // ... 405 // ...
406 // -- rsp[8 * num_arguments] : argument 0 (receiver) 406 // -- rsp[8 * num_arguments] : argument 0 (receiver)
407 // ----------------------------------- 407 // -----------------------------------
408 408
409 // TODO(1236192): Most runtime routines don't need the number of 409 // TODO(1236192): Most runtime routines don't need the number of
410 // arguments passed in because it is constant. At some point we 410 // arguments passed in because it is constant. At some point we
411 // should remove this need and make the runtime routine entry code 411 // should remove this need and make the runtime routine entry code
412 // smarter. 412 // smarter.
413 movq(rax, Immediate(num_arguments)); 413 movq(rax, Immediate(num_arguments));
414 JumpToRuntime(ext, result_size); 414 JumpToExternalReference(ext, result_size);
415 } 415 }
416 416
417 417
418 void MacroAssembler::JumpToRuntime(const ExternalReference& ext, 418 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
419 int result_size) { 419 int num_arguments,
420 int result_size) {
421 TailCallExternalReference(ExternalReference(fid), num_arguments, result_size);
422 }
423
424
425 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext,
426 int result_size) {
420 // Set the entry point and jump to the C entry runtime stub. 427 // Set the entry point and jump to the C entry runtime stub.
421 movq(rbx, ext); 428 movq(rbx, ext);
422 CEntryStub ces(result_size); 429 CEntryStub ces(result_size);
423 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 430 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
424 } 431 }
425 432
426 433
427 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) { 434 void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id, InvokeFlag flag) {
428 // Calls are not allowed in some stubs. 435 // Calls are not allowed in some stubs.
429 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls()); 436 ASSERT(flag == JUMP_FUNCTION || allow_stub_calls());
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 andl(scratch2, Immediate(kFlatAsciiStringMask)); 1393 andl(scratch2, Immediate(kFlatAsciiStringMask));
1387 // Interleave the bits to check both scratch1 and scratch2 in one test. 1394 // Interleave the bits to check both scratch1 and scratch2 in one test.
1388 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3)); 1395 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1389 lea(scratch1, Operand(scratch1, scratch2, times_8, 0)); 1396 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1390 cmpl(scratch1, 1397 cmpl(scratch1,
1391 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3))); 1398 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3)));
1392 j(not_equal, on_fail); 1399 j(not_equal, on_fail);
1393 } 1400 }
1394 1401
1395 1402
1403 void MacroAssembler::JumpIfInstanceTypeIsNotSequentialAscii(
1404 Register instance_type,
1405 Register scratch,
1406 Label *failure) {
1407 if (!scratch.is(instance_type)) {
1408 movl(scratch, instance_type);
1409 }
1410
1411 const int kFlatAsciiStringMask =
1412 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
1413
1414 andl(scratch, Immediate(kFlatAsciiStringMask));
1415 cmpl(scratch, Immediate(kStringTag | kSeqStringTag | kAsciiStringTag));
1416 j(not_equal, failure);
1417 }
1418
1419
1420 void MacroAssembler::JumpIfBothInstanceTypesAreNotSequentialAscii(
1421 Register first_object_instance_type,
1422 Register second_object_instance_type,
1423 Register scratch1,
1424 Register scratch2,
1425 Label* on_fail) {
1426 // Load instance type for both strings.
1427 movq(scratch1, first_object_instance_type);
1428 movq(scratch2, second_object_instance_type);
1429
1430 // Check that both are flat ascii strings.
1431 ASSERT(kNotStringTag != 0);
1432 const int kFlatAsciiStringMask =
1433 kIsNotStringMask | kStringRepresentationMask | kStringEncodingMask;
1434 const int kFlatAsciiStringTag = ASCII_STRING_TYPE;
1435
1436 andl(scratch1, Immediate(kFlatAsciiStringMask));
1437 andl(scratch2, Immediate(kFlatAsciiStringMask));
1438 // Interleave the bits to check both scratch1 and scratch2 in one test.
1439 ASSERT_EQ(0, kFlatAsciiStringMask & (kFlatAsciiStringMask << 3));
1440 lea(scratch1, Operand(scratch1, scratch2, times_8, 0));
1441 cmpl(scratch1,
1442 Immediate(kFlatAsciiStringTag + (kFlatAsciiStringTag << 3)));
1443 j(not_equal, on_fail);
1444 }
1445
1446
1396 void MacroAssembler::Move(Register dst, Handle<Object> source) { 1447 void MacroAssembler::Move(Register dst, Handle<Object> source) {
1397 ASSERT(!source->IsFailure()); 1448 ASSERT(!source->IsFailure());
1398 if (source->IsSmi()) { 1449 if (source->IsSmi()) {
1399 Move(dst, Smi::cast(*source)); 1450 Move(dst, Smi::cast(*source));
1400 } else { 1451 } else {
1401 movq(dst, source, RelocInfo::EMBEDDED_OBJECT); 1452 movq(dst, source, RelocInfo::EMBEDDED_OBJECT);
1402 } 1453 }
1403 } 1454 }
1404 1455
1405 1456
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after
2577 CodePatcher::~CodePatcher() { 2628 CodePatcher::~CodePatcher() {
2578 // Indicate that code has changed. 2629 // Indicate that code has changed.
2579 CPU::FlushICache(address_, size_); 2630 CPU::FlushICache(address_, size_);
2580 2631
2581 // Check that the code was patched as expected. 2632 // Check that the code was patched as expected.
2582 ASSERT(masm_.pc_ == address_ + size_); 2633 ASSERT(masm_.pc_ == address_ + size_);
2583 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2634 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2584 } 2635 }
2585 2636
2586 } } // namespace v8::internal 2637 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/regexp-macro-assembler-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698