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

Side by Side Diff: runtime/vm/stub_code_ia32.cc

Issue 311963002: In class Function replace current code field with current instruction field, that way we save one l… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3); 584 __ CallRuntime(kMegamorphicCacheMissHandlerRuntimeEntry, 3);
585 // Discard arguments. 585 // Discard arguments.
586 __ popl(EAX); 586 __ popl(EAX);
587 __ popl(EAX); 587 __ popl(EAX);
588 __ popl(EAX); 588 __ popl(EAX);
589 __ popl(EAX); // Return value from the runtime call (function). 589 __ popl(EAX); // Return value from the runtime call (function).
590 __ popl(EDX); // Restore arguments descriptor. 590 __ popl(EDX); // Restore arguments descriptor.
591 __ popl(ECX); // Restore IC data. 591 __ popl(ECX); // Restore IC data.
592 __ LeaveFrame(); 592 __ LeaveFrame();
593 593
594 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 594 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset()));
595 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset()));
596 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 595 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
597 __ jmp(EBX); 596 __ jmp(EBX);
598 } 597 }
599 598
600 599
601 // Called for inline allocation of arrays. 600 // Called for inline allocation of arrays.
602 // Input parameters: 601 // Input parameters:
603 // EDX : Array length as Smi (must be preserved). 602 // EDX : Array length as Smi (must be preserved).
604 // ECX : array element type (either NULL or an instantiated type). 603 // ECX : array element type (either NULL or an instantiated type).
605 // Uses EAX, EBX, ECX, EDI as temporary registers. 604 // Uses EAX, EBX, ECX, EDI as temporary registers.
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize; 1408 const intptr_t target_offset = ICData::TargetIndexFor(num_args) * kWordSize;
1410 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize; 1409 const intptr_t count_offset = ICData::CountIndexFor(num_args) * kWordSize;
1411 __ movl(EAX, Address(EBX, target_offset)); 1410 __ movl(EAX, Address(EBX, target_offset));
1412 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1))); 1411 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1)));
1413 __ j(NO_OVERFLOW, &call_target_function, Assembler::kNearJump); 1412 __ j(NO_OVERFLOW, &call_target_function, Assembler::kNearJump);
1414 __ movl(Address(EBX, count_offset), 1413 __ movl(Address(EBX, count_offset),
1415 Immediate(Smi::RawValue(Smi::kMaxValue))); 1414 Immediate(Smi::RawValue(Smi::kMaxValue)));
1416 1415
1417 __ Bind(&call_target_function); 1416 __ Bind(&call_target_function);
1418 // EAX: Target function. 1417 // EAX: Target function.
1419 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 1418 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset()));
1420 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset()));
1421 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1419 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1422 __ jmp(EBX); 1420 __ jmp(EBX);
1423 1421
1424 // Instance in EAX, return its class-id in EAX as Smi. 1422 // Instance in EAX, return its class-id in EAX as Smi.
1425 __ Bind(&get_class_id_as_smi); 1423 __ Bind(&get_class_id_as_smi);
1426 Label not_smi; 1424 Label not_smi;
1427 // Test if Smi -> load Smi class for comparison. 1425 // Test if Smi -> load Smi class for comparison.
1428 __ testl(EAX, Immediate(kSmiTagMask)); 1426 __ testl(EAX, Immediate(kSmiTagMask));
1429 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump); 1427 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
1430 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid))); 1428 __ movl(EAX, Immediate(Smi::RawValue(kSmiCid)));
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1558 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1))); 1556 __ addl(Address(EBX, count_offset), Immediate(Smi::RawValue(1)));
1559 __ j(NO_OVERFLOW, &increment_done, Assembler::kNearJump); 1557 __ j(NO_OVERFLOW, &increment_done, Assembler::kNearJump);
1560 __ movl(Address(EBX, count_offset), Immediate(Smi::RawValue(Smi::kMaxValue))); 1558 __ movl(Address(EBX, count_offset), Immediate(Smi::RawValue(Smi::kMaxValue)));
1561 __ Bind(&increment_done); 1559 __ Bind(&increment_done);
1562 1560
1563 // Load arguments descriptor into EDX. 1561 // Load arguments descriptor into EDX.
1564 __ movl(EDX, FieldAddress(ECX, ICData::arguments_descriptor_offset())); 1562 __ movl(EDX, FieldAddress(ECX, ICData::arguments_descriptor_offset()));
1565 1563
1566 // Get function and call it, if possible. 1564 // Get function and call it, if possible.
1567 __ movl(EAX, Address(EBX, target_offset)); 1565 __ movl(EAX, Address(EBX, target_offset));
1568 __ movl(EBX, FieldAddress(EAX, Function::code_offset())); 1566 __ movl(EBX, FieldAddress(EAX, Function::instructions_offset()));
1569 1567
1570 // EBX: Target code. 1568 // EBX: Target instructions.
1571 __ movl(EBX, FieldAddress(EBX, Code::instructions_offset()));
1572 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1569 __ addl(EBX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1573 __ jmp(EBX); 1570 __ jmp(EBX);
1574 } 1571 }
1575 1572
1576 1573
1577 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) { 1574 void StubCode::GenerateTwoArgsUnoptimizedStaticCallStub(Assembler* assembler) {
1578 GenerateUsageCounterIncrement(assembler, EBX); 1575 GenerateUsageCounterIncrement(assembler, EBX);
1579 GenerateNArgsCheckInlineCacheStub( 1576 GenerateNArgsCheckInlineCacheStub(
1580 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry); 1577 assembler, 2, kStaticCallMissHandlerTwoArgsRuntimeEntry);
1581 } 1578 }
1582 1579
1583 1580
1584 // Stub for compiling a function and jumping to the compiled code. 1581 // Stub for compiling a function and jumping to the compiled code.
1585 // ECX: IC-Data (for methods). 1582 // ECX: IC-Data (for methods).
1586 // EDX: Arguments descriptor. 1583 // EDX: Arguments descriptor.
1587 // EAX: Function. 1584 // EAX: Function.
1588 void StubCode::GenerateLazyCompileStub(Assembler* assembler) { 1585 void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
1589 __ EnterStubFrame(); 1586 __ EnterStubFrame();
1590 __ pushl(EDX); // Preserve arguments descriptor array. 1587 __ pushl(EDX); // Preserve arguments descriptor array.
1591 __ pushl(ECX); // Preserve IC data object. 1588 __ pushl(ECX); // Preserve IC data object.
1592 __ pushl(EAX); // Pass function. 1589 __ pushl(EAX); // Pass function.
1593 __ CallRuntime(kCompileFunctionRuntimeEntry, 1); 1590 __ CallRuntime(kCompileFunctionRuntimeEntry, 1);
1594 __ popl(EAX); // Restore function. 1591 __ popl(EAX); // Restore function.
1595 __ popl(ECX); // Restore IC data array. 1592 __ popl(ECX); // Restore IC data array.
1596 __ popl(EDX); // Restore arguments descriptor array. 1593 __ popl(EDX); // Restore arguments descriptor array.
1597 __ LeaveFrame(); 1594 __ LeaveFrame();
1598 1595
1599 __ movl(EAX, FieldAddress(EAX, Function::code_offset())); 1596 __ movl(EAX, FieldAddress(EAX, Function::instructions_offset()));
1600 __ movl(EAX, FieldAddress(EAX, Code::instructions_offset()));
1601 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1597 __ addl(EAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1602 __ jmp(EAX); 1598 __ jmp(EAX);
1603 } 1599 }
1604 1600
1605 1601
1606 // EDX, ECX: May contain arguments to runtime stub. 1602 // EDX, ECX: May contain arguments to runtime stub.
1607 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) { 1603 void StubCode::GenerateBreakpointRuntimeStub(Assembler* assembler) {
1608 __ EnterStubFrame(); 1604 __ EnterStubFrame();
1609 // Save runtime args. 1605 // Save runtime args.
1610 __ pushl(ECX); 1606 __ pushl(ECX);
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1916 const Register temp = ECX; 1912 const Register temp = ECX;
1917 __ movl(left, Address(ESP, 2 * kWordSize)); 1913 __ movl(left, Address(ESP, 2 * kWordSize));
1918 __ movl(right, Address(ESP, 1 * kWordSize)); 1914 __ movl(right, Address(ESP, 1 * kWordSize));
1919 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); 1915 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp);
1920 __ ret(); 1916 __ ret();
1921 } 1917 }
1922 1918
1923 } // namespace dart 1919 } // namespace dart
1924 1920
1925 #endif // defined TARGET_ARCH_IA32 1921 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698