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

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

Issue 1638006: One less dependent load in InvokeBuiltin. (Closed)
Patch Set: . Created 10 years, 8 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/serialize.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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 // Rely on the assertion to check that the number of provided 438 // Rely on the assertion to check that the number of provided
439 // arguments match the expected number of arguments. Fake a 439 // arguments match the expected number of arguments. Fake a
440 // parameter count to avoid emitting code to do the check. 440 // parameter count to avoid emitting code to do the check.
441 ParameterCount expected(0); 441 ParameterCount expected(0);
442 GetBuiltinEntry(rdx, id); 442 GetBuiltinEntry(rdx, id);
443 InvokeCode(rdx, expected, expected, flag); 443 InvokeCode(rdx, expected, expected, flag);
444 } 444 }
445 445
446 446
447 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 447 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
448 ASSERT(!target.is(rdi));
449
450 // Load the builtins object into target register.
451 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
452 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset));
453
448 // Load the JavaScript builtin function from the builtins object. 454 // Load the JavaScript builtin function from the builtins object.
449 movq(rdi, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); 455 movq(rdi, FieldOperand(target, JSBuiltinsObject::OffsetOfFunctionWithId(id)));
450 movq(rdi, FieldOperand(rdi, GlobalObject::kBuiltinsOffset)); 456
451 int builtins_offset = 457 // Load the code entry point from the builtins object.
452 JSBuiltinsObject::kJSBuiltinsOffset + (id * kPointerSize); 458 movq(target, FieldOperand(target, JSBuiltinsObject::OffsetOfCodeWithId(id)));
453 movq(rdi, FieldOperand(rdi, builtins_offset)); 459 lea(target, FieldOperand(target, Code::kHeaderSize));
454 // Load the code entry point from the function into the target register.
455 movq(target, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
456 movq(target, FieldOperand(target, SharedFunctionInfo::kCodeOffset));
457 addq(target, Immediate(Code::kHeaderSize - kHeapObjectTag));
458 } 460 }
459 461
460 462
461 void MacroAssembler::Set(Register dst, int64_t x) { 463 void MacroAssembler::Set(Register dst, int64_t x) {
462 if (x == 0) { 464 if (x == 0) {
463 xor_(dst, dst); 465 xor_(dst, dst);
464 } else if (is_int32(x)) { 466 } else if (is_int32(x)) {
465 movq(dst, Immediate(static_cast<int32_t>(x))); 467 movq(dst, Immediate(static_cast<int32_t>(x)));
466 } else if (is_uint32(x)) { 468 } else if (is_uint32(x)) {
467 movl(dst, Immediate(static_cast<uint32_t>(x))); 469 movl(dst, Immediate(static_cast<uint32_t>(x)));
(...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2637 CodePatcher::~CodePatcher() { 2639 CodePatcher::~CodePatcher() {
2638 // Indicate that code has changed. 2640 // Indicate that code has changed.
2639 CPU::FlushICache(address_, size_); 2641 CPU::FlushICache(address_, size_);
2640 2642
2641 // Check that the code was patched as expected. 2643 // Check that the code was patched as expected.
2642 ASSERT(masm_.pc_ == address_ + size_); 2644 ASSERT(masm_.pc_ == address_ + size_);
2643 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2645 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2644 } 2646 }
2645 2647
2646 } } // namespace v8::internal 2648 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/serialize.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698