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

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

Issue 3156028: Change code pointer in function objects to a pointer to the first... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 4 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') | 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 // Rely on the assertion to check that the number of provided 575 // Rely on the assertion to check that the number of provided
576 // arguments match the expected number of arguments. Fake a 576 // arguments match the expected number of arguments. Fake a
577 // parameter count to avoid emitting code to do the check. 577 // parameter count to avoid emitting code to do the check.
578 ParameterCount expected(0); 578 ParameterCount expected(0);
579 GetBuiltinEntry(rdx, id); 579 GetBuiltinEntry(rdx, id);
580 InvokeCode(rdx, expected, expected, flag); 580 InvokeCode(rdx, expected, expected, flag);
581 } 581 }
582 582
583 583
584 void MacroAssembler::GetBuiltinFunction(Register target,
585 Builtins::JavaScript id) {
586 // Load the builtins object into target register.
587 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
588 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset));
589 movq(target, FieldOperand(target,
590 JSBuiltinsObject::OffsetOfFunctionWithId(id)));
591 }
592
593
584 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) { 594 void MacroAssembler::GetBuiltinEntry(Register target, Builtins::JavaScript id) {
585 ASSERT(!target.is(rdi)); 595 ASSERT(!target.is(rdi));
586
587 // Load the builtins object into target register.
588 movq(target, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX)));
589 movq(target, FieldOperand(target, GlobalObject::kBuiltinsOffset));
590
591 // Load the JavaScript builtin function from the builtins object. 596 // Load the JavaScript builtin function from the builtins object.
592 movq(rdi, FieldOperand(target, JSBuiltinsObject::OffsetOfFunctionWithId(id))); 597 GetBuiltinFunction(rdi, id);
593 598 movq(target, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
594 // Load the code entry point from the builtins object.
595 movq(target, FieldOperand(target, JSBuiltinsObject::OffsetOfCodeWithId(id)));
596 if (FLAG_debug_code) {
597 // Make sure the code objects in the builtins object and in the
598 // builtin function are the same.
599 push(target);
600 movq(target, FieldOperand(rdi, JSFunction::kCodeOffset));
601 cmpq(target, Operand(rsp, 0));
602 Assert(equal, "Builtin code object changed");
603 pop(target);
604 }
605 lea(target, FieldOperand(target, Code::kHeaderSize));
606 } 599 }
607 600
608 601
609 void MacroAssembler::Set(Register dst, int64_t x) { 602 void MacroAssembler::Set(Register dst, int64_t x) {
610 if (x == 0) { 603 if (x == 0) {
611 xorl(dst, dst); 604 xorl(dst, dst);
612 } else if (is_int32(x)) { 605 } else if (is_int32(x)) {
613 movq(dst, Immediate(static_cast<int32_t>(x))); 606 movq(dst, Immediate(static_cast<int32_t>(x)));
614 } else if (is_uint32(x)) { 607 } else if (is_uint32(x)) {
615 movl(dst, Immediate(static_cast<uint32_t>(x))); 608 movl(dst, Immediate(static_cast<uint32_t>(x)));
(...skipping 1688 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 2297
2305 2298
2306 void MacroAssembler::InvokeFunction(Register function, 2299 void MacroAssembler::InvokeFunction(Register function,
2307 const ParameterCount& actual, 2300 const ParameterCount& actual,
2308 InvokeFlag flag) { 2301 InvokeFlag flag) {
2309 ASSERT(function.is(rdi)); 2302 ASSERT(function.is(rdi));
2310 movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset)); 2303 movq(rdx, FieldOperand(function, JSFunction::kSharedFunctionInfoOffset));
2311 movq(rsi, FieldOperand(function, JSFunction::kContextOffset)); 2304 movq(rsi, FieldOperand(function, JSFunction::kContextOffset));
2312 movsxlq(rbx, 2305 movsxlq(rbx,
2313 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); 2306 FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset));
2314 movq(rdx, FieldOperand(rdi, JSFunction::kCodeOffset));
2315 // Advances rdx to the end of the Code object header, to the start of 2307 // Advances rdx to the end of the Code object header, to the start of
2316 // the executable code. 2308 // the executable code.
2317 lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); 2309 movq(rdx, FieldOperand(rdi, JSFunction::kCodeEntryOffset));
2318 2310
2319 ParameterCount expected(rbx); 2311 ParameterCount expected(rbx);
2320 InvokeCode(rdx, expected, actual, flag); 2312 InvokeCode(rdx, expected, actual, flag);
2321 } 2313 }
2322 2314
2323 2315
2324 void MacroAssembler::InvokeFunction(JSFunction* function, 2316 void MacroAssembler::InvokeFunction(JSFunction* function,
2325 const ParameterCount& actual, 2317 const ParameterCount& actual,
2326 InvokeFlag flag) { 2318 InvokeFlag flag) {
2327 ASSERT(function->is_compiled()); 2319 ASSERT(function->is_compiled());
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
2969 CPU::FlushICache(address_, size_); 2961 CPU::FlushICache(address_, size_);
2970 2962
2971 // Check that the code was patched as expected. 2963 // Check that the code was patched as expected.
2972 ASSERT(masm_.pc_ == address_ + size_); 2964 ASSERT(masm_.pc_ == address_ + size_);
2973 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2965 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2974 } 2966 }
2975 2967
2976 } } // namespace v8::internal 2968 } } // namespace v8::internal
2977 2969
2978 #endif // V8_TARGET_ARCH_X64 2970 #endif // V8_TARGET_ARCH_X64
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