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

Unified Diff: runtime/vm/stub_code_ia32.cc

Issue 2371983002: Prefer loading Smi 0 instead of null into a runtime call result slot. (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/stub_code_arm64.cc ('k') | runtime/vm/stub_code_mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_ia32.cc
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index ee29ed5b72ec22df940b6a154101c5f688826387..cb805c6d96ac5703cab49b76c6e101fcbc211232 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -248,11 +248,9 @@ void StubCode::GenerateCallBootstrapCFunctionStub(Assembler* assembler) {
// Input parameters:
// EDX: arguments descriptor array.
void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ CallRuntime(kPatchStaticCallRuntimeEntry, 0);
__ popl(EAX); // Get Code object result.
__ popl(EDX); // Restore arguments descriptor array.
@@ -268,13 +266,11 @@ void StubCode::GenerateCallStaticFunctionStub(Assembler* assembler) {
// (invalid because its function was optimized or deoptimized).
// EDX: arguments descriptor array.
void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ CallRuntime(kFixCallersTargetRuntimeEntry, 0);
__ popl(EAX); // Get Code object.
__ popl(EDX); // Restore arguments descriptor array.
@@ -288,10 +284,8 @@ void StubCode::GenerateFixCallersTargetStub(Assembler* assembler) {
// Called from object allocate instruction when the allocation stub has been
// disabled.
void StubCode::GenerateFixAllocationStubTargetStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ EnterStubFrame();
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ CallRuntime(kFixAllocationStubTargetRuntimeEntry, 0);
__ popl(EAX); // Get Code object.
__ movl(EAX, FieldAddress(EAX, Code::entry_point_offset()));
@@ -476,7 +470,7 @@ static void GenerateDispatcherCode(Assembler* assembler,
__ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
__ movl(EAX, Address(
EBP, EDI, TIMES_HALF_WORD_SIZE, kParamEndSlotFromFp * kWordSize));
- __ pushl(raw_null); // Setup space on stack for result.
+ __ pushl(Immediate(0)); // Setup space on stack for result.
__ pushl(EAX); // Receiver.
__ pushl(ECX); // ICData/MegamorphicCache.
__ pushl(EDX); // Arguments descriptor array.
@@ -504,9 +498,7 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
__ pushl(ECX);
__ pushl(EDX);
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Instructions::null()));
- __ pushl(raw_null); // Space for the result of the runtime call.
+ __ pushl(Immediate(0)); // Space for the result of the runtime call.
__ pushl(EAX); // Pass receiver.
__ pushl(ECX); // Pass IC data.
__ pushl(EDX); // Pass arguments descriptor.
@@ -539,8 +531,6 @@ void StubCode::GenerateMegamorphicMissStub(Assembler* assembler) {
// The newly allocated object is returned in EAX.
void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
Label slow_case;
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
// Compute the size to be allocated, it is based on the array length
// and is computed as:
// RoundedAllocationSize((array_length * kwordSize) + sizeof(RawArray)).
@@ -661,7 +651,7 @@ void StubCode::GenerateAllocateArrayStub(Assembler* assembler) {
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame();
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ pushl(EDX); // Array length as Smi.
__ pushl(ECX); // Element type.
__ CallRuntime(kAllocateArrayRuntimeEntry, 2);
@@ -789,8 +779,6 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
// EAX: new allocated RawContext object.
// EBX and EDX are destroyed.
void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
if (FLAG_inline_alloc) {
Label slow_case;
// First compute the rounded instance size.
@@ -905,7 +893,7 @@ void StubCode::GenerateAllocateContextStub(Assembler* assembler) {
// Create a stub frame as we are pushing some objects on the stack before
// calling into the runtime.
__ EnterStubFrame();
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ SmiTag(EDX);
__ pushl(EDX);
__ CallRuntime(kAllocateContextRuntimeEntry, 1); // Allocate context.
@@ -1133,9 +1121,7 @@ void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) {
__ movl(EDI, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
__ movl(EAX, Address(EBP, EDI, TIMES_2, kParamEndSlotFromFp * kWordSize));
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ pushl(raw_null); // Setup space on stack for result from noSuchMethod.
+ __ pushl(Immediate(0)); // Setup space on stack for result from noSuchMethod.
__ pushl(EAX); // Receiver.
__ pushl(EDX); // Arguments descriptor array.
@@ -1368,8 +1354,6 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(
__ j(NOT_EQUAL, &loop, Assembler::kNearJump);
__ Comment("IC miss");
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
// Compute address of arguments (first read number of arguments from
// arguments descriptor array and then compute address on the stack).
__ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
@@ -1379,7 +1363,7 @@ void StubCode::GenerateNArgsCheckInlineCacheStub(
__ EnterStubFrame();
__ pushl(EDX); // Preserve arguments descriptor array.
__ pushl(ECX); // Preserve IC data object.
- __ pushl(raw_null); // Setup space on stack for result (target code object).
+ __ pushl(Immediate(0)); // Result slot.
// Push call arguments.
for (intptr_t i = 0; i < num_args; i++) {
__ movl(EBX, Address(EAX, -kWordSize * i));
@@ -1624,9 +1608,7 @@ void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
__ pushl(ECX);
// Room for result. Debugger stub returns address of the
// unpatched runtime stub.
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ pushl(raw_null); // Room for result.
+ __ pushl(Immediate(0)); // Room for result.
__ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
__ popl(EAX); // Code of original stub.
__ popl(ECX); // Restore IC data.
@@ -1641,9 +1623,7 @@ void StubCode::GenerateRuntimeCallBreakpointStub(Assembler* assembler) {
__ EnterStubFrame();
// Room for result. Debugger stub returns address of the
// unpatched runtime stub.
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ pushl(raw_null); // Room for result.
+ __ pushl(Immediate(0)); // Room for result.
__ CallRuntime(kBreakpointRuntimeHandlerRuntimeEntry, 0);
__ popl(EAX); // Code of the original stub
__ LeaveFrame();
@@ -1827,11 +1807,9 @@ void StubCode::GenerateJumpToExceptionHandlerStub(Assembler* assembler) {
// EBX: function to be reoptimized.
// EDX: argument descriptor (preserved).
void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ EnterStubFrame();
__ pushl(EDX);
- __ pushl(raw_null); // Setup space on stack for return value.
+ __ pushl(Immediate(0)); // Setup space on stack for return value.
__ pushl(EBX);
__ CallRuntime(kOptimizeInvokedFunctionRuntimeEntry, 1);
__ popl(EAX); // Discard argument.
« 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