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

Side by Side Diff: src/code-stubs.cc

Issue 2647493002: [ic] Clean up handler boilerplate (Closed)
Patch Set: rebased Created 3 years, 11 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/code-stubs.h ('k') | src/ic/accessor-assembler.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
11 #include "src/code-factory.h" 11 #include "src/code-factory.h"
12 #include "src/code-stub-assembler.h" 12 #include "src/code-stub-assembler.h"
13 #include "src/factory.h" 13 #include "src/factory.h"
14 #include "src/gdb-jit.h" 14 #include "src/gdb-jit.h"
15 #include "src/ic/accessor-assembler.h"
16 #include "src/ic/handler-compiler.h"
17 #include "src/ic/ic-stats.h" 15 #include "src/ic/ic-stats.h"
18 #include "src/ic/ic.h" 16 #include "src/ic/ic.h"
19 #include "src/macro-assembler.h" 17 #include "src/macro-assembler.h"
20 #include "src/tracing/tracing-category-observer.h" 18 #include "src/tracing/tracing-category-observer.h"
21 19
22 namespace v8 { 20 namespace v8 {
23 namespace internal { 21 namespace internal {
24 22
25 using compiler::CodeAssemblerState; 23 using compiler::CodeAssemblerState;
26 24
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 Handle<Code> TurboFanCodeStub::GenerateCode() { 430 Handle<Code> TurboFanCodeStub::GenerateCode() {
433 const char* name = CodeStub::MajorName(MajorKey()); 431 const char* name = CodeStub::MajorName(MajorKey());
434 Zone zone(isolate()->allocator(), ZONE_NAME); 432 Zone zone(isolate()->allocator(), ZONE_NAME);
435 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); 433 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor());
436 compiler::CodeAssemblerState state(isolate(), &zone, descriptor, 434 compiler::CodeAssemblerState state(isolate(), &zone, descriptor,
437 GetCodeFlags(), name); 435 GetCodeFlags(), name);
438 GenerateAssembly(&state); 436 GenerateAssembly(&state);
439 return compiler::CodeAssembler::GenerateCode(&state); 437 return compiler::CodeAssembler::GenerateCode(&state);
440 } 438 }
441 439
442 void LoadICProtoArrayStub::GenerateAssembly(CodeAssemblerState* state) const {
443 AccessorAssembler::GenerateLoadICProtoArray(
444 state, throw_reference_error_if_nonexistent());
445 }
446
447 void ElementsTransitionAndStoreStub::GenerateAssembly( 440 void ElementsTransitionAndStoreStub::GenerateAssembly(
448 compiler::CodeAssemblerState* state) const { 441 compiler::CodeAssemblerState* state) const {
449 typedef CodeStubAssembler::Label Label; 442 typedef CodeStubAssembler::Label Label;
450 typedef compiler::Node Node; 443 typedef compiler::Node Node;
451 CodeStubAssembler assembler(state); 444 CodeStubAssembler assembler(state);
452 445
453 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 446 Node* receiver = assembler.Parameter(Descriptor::kReceiver);
454 Node* key = assembler.Parameter(Descriptor::kName); 447 Node* key = assembler.Parameter(Descriptor::kName);
455 Node* value = assembler.Parameter(Descriptor::kValue); 448 Node* value = assembler.Parameter(Descriptor::kValue);
456 Node* map = assembler.Parameter(Descriptor::kMap); 449 Node* map = assembler.Parameter(Descriptor::kMap);
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1611 assembler.Return(value); 1604 assembler.Return(value);
1612 1605
1613 assembler.Bind(&miss); 1606 assembler.Bind(&miss);
1614 { 1607 {
1615 assembler.Comment("Miss"); 1608 assembler.Comment("Miss");
1616 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot, 1609 assembler.TailCallRuntime(Runtime::kStoreIC_Miss, context, value, slot,
1617 vector, receiver, name); 1610 vector, receiver, name);
1618 } 1611 }
1619 } 1612 }
1620 1613
1621 void LoadFieldStub::GenerateAssembly(
1622 compiler::CodeAssemblerState* state) const {
1623 AccessorAssembler::GenerateLoadField(state);
1624 }
1625
1626 void KeyedLoadSloppyArgumentsStub::GenerateAssembly( 1614 void KeyedLoadSloppyArgumentsStub::GenerateAssembly(
1627 compiler::CodeAssemblerState* state) const { 1615 compiler::CodeAssemblerState* state) const {
1628 typedef CodeStubAssembler::Label Label; 1616 typedef CodeStubAssembler::Label Label;
1629 typedef compiler::Node Node; 1617 typedef compiler::Node Node;
1630 CodeStubAssembler assembler(state); 1618 CodeStubAssembler assembler(state);
1631 1619
1632 Node* receiver = assembler.Parameter(Descriptor::kReceiver); 1620 Node* receiver = assembler.Parameter(Descriptor::kReceiver);
1633 Node* key = assembler.Parameter(Descriptor::kName); 1621 Node* key = assembler.Parameter(Descriptor::kName);
1634 Node* slot = assembler.Parameter(Descriptor::kSlot); 1622 Node* slot = assembler.Parameter(Descriptor::kSlot);
1635 Node* vector = assembler.Parameter(Descriptor::kVector); 1623 Node* vector = assembler.Parameter(Descriptor::kVector);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 } 1760 }
1773 1761
1774 1762
1775 void JSEntryStub::FinishCode(Handle<Code> code) { 1763 void JSEntryStub::FinishCode(Handle<Code> code) {
1776 Handle<FixedArray> handler_table = 1764 Handle<FixedArray> handler_table =
1777 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); 1765 code->GetIsolate()->factory()->NewFixedArray(1, TENURED);
1778 handler_table->set(0, Smi::FromInt(handler_offset_)); 1766 handler_table->set(0, Smi::FromInt(handler_offset_));
1779 code->set_handler_table(*handler_table); 1767 code->set_handler_table(*handler_table);
1780 } 1768 }
1781 1769
1782
1783 void HandlerStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
1784 DCHECK(kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC);
1785 if (kind() == Code::KEYED_LOAD_IC) {
1786 descriptor->Initialize(
1787 FUNCTION_ADDR(Runtime_KeyedLoadIC_MissFromStubFailure));
1788 }
1789 }
1790
1791
1792 CallInterfaceDescriptor HandlerStub::GetCallInterfaceDescriptor() const {
1793 if (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC) {
1794 return LoadWithVectorDescriptor(isolate());
1795 } else {
1796 DCHECK(kind() == Code::STORE_IC || kind() == Code::KEYED_STORE_IC);
1797 return StoreWithVectorDescriptor(isolate());
1798 }
1799 }
1800
1801 void TransitionElementsKindStub::InitializeDescriptor( 1770 void TransitionElementsKindStub::InitializeDescriptor(
1802 CodeStubDescriptor* descriptor) { 1771 CodeStubDescriptor* descriptor) {
1803 descriptor->Initialize( 1772 descriptor->Initialize(
1804 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry); 1773 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry);
1805 } 1774 }
1806 1775
1807 1776
1808 void AllocateHeapNumberStub::InitializeDescriptor( 1777 void AllocateHeapNumberStub::InitializeDescriptor(
1809 CodeStubDescriptor* descriptor) { 1778 CodeStubDescriptor* descriptor) {
1810 descriptor->Initialize( 1779 descriptor->Initialize(
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
2208 } 2177 }
2209 2178
2210 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate) 2179 ArrayConstructorStub::ArrayConstructorStub(Isolate* isolate)
2211 : PlatformCodeStub(isolate) {} 2180 : PlatformCodeStub(isolate) {}
2212 2181
2213 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate) 2182 InternalArrayConstructorStub::InternalArrayConstructorStub(Isolate* isolate)
2214 : PlatformCodeStub(isolate) {} 2183 : PlatformCodeStub(isolate) {}
2215 2184
2216 } // namespace internal 2185 } // namespace internal
2217 } // namespace v8 2186 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/ic/accessor-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698