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

Side by Side Diff: src/compiler/js-generic-lowering.cc

Issue 434343005: Implement lowering of JSStoreProperty to ICs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | « no previous file | 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/common-operator.h" 6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/compiler/js-generic-lowering.h" 8 #include "src/compiler/js-generic-lowering.h"
9 #include "src/compiler/machine-operator.h" 9 #include "src/compiler/machine-operator.h"
10 #include "src/compiler/node-aux-data-inl.h" 10 #include "src/compiler/node-aux-data-inl.h"
(...skipping 11 matching lines...) Expand all
22 template <typename T> 22 template <typename T>
23 static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate, 23 static CodeStubInterfaceDescriptor* GetInterfaceDescriptor(Isolate* isolate,
24 T* stub) { 24 T* stub) {
25 CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey(); 25 CodeStub::Major key = static_cast<CodeStub*>(stub)->MajorKey();
26 CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key); 26 CodeStubInterfaceDescriptor* d = isolate->code_stub_interface_descriptor(key);
27 stub->InitializeInterfaceDescriptor(d); 27 stub->InitializeInterfaceDescriptor(d);
28 return d; 28 return d;
29 } 29 }
30 30
31 31
32 // TODO(mstarzinger): This is a temporary shim to be able to call an IC stub
33 // which doesn't have an interface descriptor yet. It mimics a hydrogen code
34 // stub for the underlying IC stub code.
35 class KeyedStoreICStubShim : public HydrogenCodeStub {
36 public:
37 KeyedStoreICStubShim(Isolate* isolate, StrictMode strict_mode)
38 : HydrogenCodeStub(isolate), strict_mode_(strict_mode) {
39 i::compiler::GetInterfaceDescriptor(isolate, this);
40 }
41
42 virtual Handle<Code> GenerateCode() V8_OVERRIDE {
43 return strict_mode_ == SLOPPY
44 ? isolate()->builtins()->KeyedStoreIC_Initialize()
45 : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
46 }
47
48 virtual void InitializeInterfaceDescriptor(
49 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE {
50 Register registers[] = { InterfaceDescriptor::ContextRegister(),
51 KeyedStoreIC::ReceiverRegister(),
52 KeyedStoreIC::NameRegister(),
53 KeyedStoreIC::ValueRegister() };
54 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers);
55 }
56
57 private:
58 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
59 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
60 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
61
62 StrictMode strict_mode_;
63 };
64
65
32 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, 66 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph,
33 MachineOperatorBuilder* machine, 67 MachineOperatorBuilder* machine,
34 SourcePositionTable* source_positions) 68 SourcePositionTable* source_positions)
35 : LoweringBuilder(jsgraph->graph(), source_positions), 69 : LoweringBuilder(jsgraph->graph(), source_positions),
36 info_(info), 70 info_(info),
37 jsgraph_(jsgraph), 71 jsgraph_(jsgraph),
38 linkage_(new (jsgraph->zone()) Linkage(info)), 72 linkage_(new (jsgraph->zone()) Linkage(info)),
39 machine_(machine) {} 73 machine_(machine) {}
40 74
41 75
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // because named interceptors would not fire correctly yet. 348 // because named interceptors would not fire correctly yet.
315 ReplaceWithRuntimeCall(node, Runtime::kGetProperty); 349 ReplaceWithRuntimeCall(node, Runtime::kGetProperty);
316 return node; 350 return node;
317 } 351 }
318 352
319 353
320 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) { 354 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
321 // TODO(mstarzinger): The strict_mode needs to be carried along in the 355 // TODO(mstarzinger): The strict_mode needs to be carried along in the
322 // operator so that graphs are fully compositional for inlining. 356 // operator so that graphs are fully compositional for inlining.
323 StrictMode strict_mode = info()->strict_mode(); 357 StrictMode strict_mode = info()->strict_mode();
324 PatchInsertInput(node, 3, SmiConstant(strict_mode)); 358 KeyedStoreICStubShim stub(isolate(), strict_mode);
325 ReplaceWithRuntimeCall(node, Runtime::kSetProperty, 4); 359 ReplaceWithICStubCall(node, &stub);
326 return node; 360 return node;
327 } 361 }
328 362
329 363
330 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) { 364 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) {
331 // TODO(mstarzinger): The strict_mode needs to be carried along in the 365 // TODO(mstarzinger): The strict_mode needs to be carried along in the
332 // operator so that graphs are fully compositional for inlining. 366 // operator so that graphs are fully compositional for inlining.
333 StrictMode strict_mode = info()->strict_mode(); 367 StrictMode strict_mode = info()->strict_mode();
334 Node* key = 368 Node* key =
335 jsgraph()->HeapConstant(OpParameter<PrintableUnique<Name> >(node)); 369 jsgraph()->HeapConstant(OpParameter<PrintableUnique<Name> >(node));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 469
436 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 470 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
437 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 471 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
438 int arity = NodeProperties::GetValueInputCount(node); 472 int arity = NodeProperties::GetValueInputCount(node);
439 ReplaceWithRuntimeCall(node, function, arity); 473 ReplaceWithRuntimeCall(node, function, arity);
440 return node; 474 return node;
441 } 475 }
442 } 476 }
443 } 477 }
444 } // namespace v8::internal::compiler 478 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698