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

Side by Side Diff: src/x64/builtins-x64.cc

Issue 6824074: X64: Tweak code generation slightly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments. Created 9 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/code-stubs-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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Jump to the function-specific construct stub. 89 // Jump to the function-specific construct stub.
90 __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); 90 __ movq(rbx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset));
91 __ movq(rbx, FieldOperand(rbx, SharedFunctionInfo::kConstructStubOffset)); 91 __ movq(rbx, FieldOperand(rbx, SharedFunctionInfo::kConstructStubOffset));
92 __ lea(rbx, FieldOperand(rbx, Code::kHeaderSize)); 92 __ lea(rbx, FieldOperand(rbx, Code::kHeaderSize));
93 __ jmp(rbx); 93 __ jmp(rbx);
94 94
95 // rdi: called object 95 // rdi: called object
96 // rax: number of arguments 96 // rax: number of arguments
97 __ bind(&non_function_call); 97 __ bind(&non_function_call);
98 // Set expected number of arguments to zero (not changing rax). 98 // Set expected number of arguments to zero (not changing rax).
99 __ movq(rbx, Immediate(0)); 99 __ Set(rbx, 0);
100 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR); 100 __ GetBuiltinEntry(rdx, Builtins::CALL_NON_FUNCTION_AS_CONSTRUCTOR);
101 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 101 __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
102 RelocInfo::CODE_TARGET); 102 RelocInfo::CODE_TARGET);
103 } 103 }
104 104
105 105
106 static void Generate_JSConstructStubHelper(MacroAssembler* masm, 106 static void Generate_JSConstructStubHelper(MacroAssembler* masm,
107 bool is_api_function, 107 bool is_api_function,
108 bool count_constructions) { 108 bool count_constructions) {
109 // Should never count constructions for api objects. 109 // Should never count constructions for api objects.
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); 1365 __ cmpq(rbx, Immediate(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1366 __ j(equal, &dont_adapt_arguments); 1366 __ j(equal, &dont_adapt_arguments);
1367 1367
1368 { // Enough parameters: Actual >= expected. 1368 { // Enough parameters: Actual >= expected.
1369 __ bind(&enough); 1369 __ bind(&enough);
1370 EnterArgumentsAdaptorFrame(masm); 1370 EnterArgumentsAdaptorFrame(masm);
1371 1371
1372 // Copy receiver and all expected arguments. 1372 // Copy receiver and all expected arguments.
1373 const int offset = StandardFrameConstants::kCallerSPOffset; 1373 const int offset = StandardFrameConstants::kCallerSPOffset;
1374 __ lea(rax, Operand(rbp, rax, times_pointer_size, offset)); 1374 __ lea(rax, Operand(rbp, rax, times_pointer_size, offset));
1375 __ movq(rcx, Immediate(-1)); // account for receiver 1375 __ Set(rcx, -1); // account for receiver
1376 1376
1377 Label copy; 1377 Label copy;
1378 __ bind(&copy); 1378 __ bind(&copy);
1379 __ incq(rcx); 1379 __ incq(rcx);
1380 __ push(Operand(rax, 0)); 1380 __ push(Operand(rax, 0));
1381 __ subq(rax, Immediate(kPointerSize)); 1381 __ subq(rax, Immediate(kPointerSize));
1382 __ cmpq(rcx, rbx); 1382 __ cmpq(rcx, rbx);
1383 __ j(less, &copy); 1383 __ j(less, &copy);
1384 __ jmp(&invoke); 1384 __ jmp(&invoke);
1385 } 1385 }
1386 1386
1387 { // Too few parameters: Actual < expected. 1387 { // Too few parameters: Actual < expected.
1388 __ bind(&too_few); 1388 __ bind(&too_few);
1389 EnterArgumentsAdaptorFrame(masm); 1389 EnterArgumentsAdaptorFrame(masm);
1390 1390
1391 // Copy receiver and all actual arguments. 1391 // Copy receiver and all actual arguments.
1392 const int offset = StandardFrameConstants::kCallerSPOffset; 1392 const int offset = StandardFrameConstants::kCallerSPOffset;
1393 __ lea(rdi, Operand(rbp, rax, times_pointer_size, offset)); 1393 __ lea(rdi, Operand(rbp, rax, times_pointer_size, offset));
1394 __ movq(rcx, Immediate(-1)); // account for receiver 1394 __ Set(rcx, -1); // account for receiver
1395 1395
1396 Label copy; 1396 Label copy;
1397 __ bind(&copy); 1397 __ bind(&copy);
1398 __ incq(rcx); 1398 __ incq(rcx);
1399 __ push(Operand(rdi, 0)); 1399 __ push(Operand(rdi, 0));
1400 __ subq(rdi, Immediate(kPointerSize)); 1400 __ subq(rdi, Immediate(kPointerSize));
1401 __ cmpq(rcx, rax); 1401 __ cmpq(rcx, rax);
1402 __ j(less, &copy); 1402 __ j(less, &copy);
1403 1403
1404 // Fill remaining expected arguments with undefined values. 1404 // Fill remaining expected arguments with undefined values.
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); 1484 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR);
1485 generator.Generate(); 1485 generator.Generate();
1486 } 1486 }
1487 1487
1488 1488
1489 #undef __ 1489 #undef __
1490 1490
1491 } } // namespace v8::internal 1491 } } // namespace v8::internal
1492 1492
1493 #endif // V8_TARGET_ARCH_X64 1493 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698