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

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

Issue 473263004: Towards removing dependency from generic lowering on compilation info. (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
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 private: 149 private:
150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; } 150 virtual Major MajorKey() const V8_OVERRIDE { return NoCache; }
151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; } 151 virtual int NotMissMinorKey() const V8_OVERRIDE { return 0; }
152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; } 152 virtual bool UseSpecialCache() V8_OVERRIDE { return true; }
153 153
154 StrictMode strict_mode_; 154 StrictMode strict_mode_;
155 }; 155 };
156 156
157 157
158 JSGenericLowering::JSGenericLowering(CompilationInfo* info, JSGraph* jsgraph, 158 JSGenericLowering::JSGenericLowering(JSGraph* jsgraph,
159 JSContextSpecializer* spec,
160 Linkage* linkage,
159 MachineOperatorBuilder* machine) 161 MachineOperatorBuilder* machine)
160 : info_(info), 162 : jsgraph_(jsgraph), spec_(spec), linkage_(linkage), machine_(machine) {}
161 jsgraph_(jsgraph),
162 linkage_(new (jsgraph->zone()) Linkage(info)),
163 machine_(machine) {}
164 163
165 164
166 void JSGenericLowering::PatchOperator(Node* node, Operator* op) { 165 void JSGenericLowering::PatchOperator(Node* node, Operator* op) {
167 node->set_op(op); 166 node->set_op(op);
168 } 167 }
169 168
170 169
171 void JSGenericLowering::PatchInsertInput(Node* node, int index, Node* input) { 170 void JSGenericLowering::PatchInsertInput(Node* node, int index, Node* input) {
172 node->InsertInput(zone(), index, input); 171 node->InsertInput(zone(), index, input);
173 } 172 }
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 PatchOperator(node, common()->Call(desc)); 332 PatchOperator(node, common()->Call(desc));
334 } 333 }
335 334
336 335
337 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, 336 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
338 Builtins::JavaScript id, 337 Builtins::JavaScript id,
339 int nargs) { 338 int nargs) {
340 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); 339 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
341 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); 340 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
342 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs); 341 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, nargs);
343 // TODO(mstarzinger): Accessing the builtins object this way prevents sharing 342
344 // of code across native contexts. Fix this by loading from given context. 343 Node* function_node = spec_->InsertBuiltinLoadBefore(node, id);
345 Handle<JSFunction> function(
346 JSFunction::cast(info()->context()->builtins()->javascript_builtin(id)));
347 Node* stub_code = CodeConstant(stub.GetCode()); 344 Node* stub_code = CodeConstant(stub.GetCode());
348 Node* function_node = FunctionConstant(function);
349 PatchInsertInput(node, 0, stub_code); 345 PatchInsertInput(node, 0, stub_code);
350 PatchInsertInput(node, 1, function_node); 346 PatchInsertInput(node, 1, function_node);
351 PatchOperator(node, common()->Call(desc)); 347 PatchOperator(node, common()->Call(desc));
352 } 348 }
353 349
354 350
355 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, 351 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
356 Runtime::FunctionId f, 352 Runtime::FunctionId f,
357 int nargs_override) { 353 int nargs_override) {
358 Operator::Property props = node->op()->properties(); 354 Operator::Property props = node->op()->properties();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 Node* JSGenericLowering::LowerJSLoadNamed(Node* node) { 406 Node* JSGenericLowering::LowerJSLoadNamed(Node* node) {
411 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node); 407 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
412 LoadICStubShim stub(isolate(), p.contextual_mode); 408 LoadICStubShim stub(isolate(), p.contextual_mode);
413 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name)); 409 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
414 ReplaceWithICStubCall(node, &stub); 410 ReplaceWithICStubCall(node, &stub);
415 return node; 411 return node;
416 } 412 }
417 413
418 414
419 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) { 415 Node* JSGenericLowering::LowerJSStoreProperty(Node* node) {
420 // TODO(mstarzinger): The strict_mode needs to be carried along in the 416 StrictMode strict_mode = OpParameter<StrictMode>(node);
421 // operator so that graphs are fully compositional for inlining.
422 StrictMode strict_mode = info()->strict_mode();
423 KeyedStoreICStubShim stub(isolate(), strict_mode); 417 KeyedStoreICStubShim stub(isolate(), strict_mode);
424 ReplaceWithICStubCall(node, &stub); 418 ReplaceWithICStubCall(node, &stub);
425 return node; 419 return node;
426 } 420 }
427 421
428 422
429 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) { 423 Node* JSGenericLowering::LowerJSStoreNamed(Node* node) {
430 PrintableUnique<Name> key = OpParameter<PrintableUnique<Name> >(node); 424 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node);
431 // TODO(mstarzinger): The strict_mode needs to be carried along in the 425 StoreICStubShim stub(isolate(), params.strict_mode);
432 // operator so that graphs are fully compositional for inlining. 426 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name));
433 StrictMode strict_mode = info()->strict_mode();
434 StoreICStubShim stub(isolate(), strict_mode);
435 PatchInsertInput(node, 1, jsgraph()->HeapConstant(key));
436 ReplaceWithICStubCall(node, &stub); 427 ReplaceWithICStubCall(node, &stub);
437 return node; 428 return node;
438 } 429 }
439 430
440 431
441 Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) { 432 Node* JSGenericLowering::LowerJSDeleteProperty(Node* node) {
442 StrictMode strict_mode = OpParameter<StrictMode>(node); 433 StrictMode strict_mode = OpParameter<StrictMode>(node);
443 PatchInsertInput(node, 2, SmiConstant(strict_mode)); 434 PatchInsertInput(node, 2, SmiConstant(strict_mode));
444 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); 435 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
445 return node; 436 return node;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
535 526
536 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 527 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
537 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 528 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
538 int arity = OperatorProperties::GetValueInputCount(node->op()); 529 int arity = OperatorProperties::GetValueInputCount(node->op());
539 ReplaceWithRuntimeCall(node, function, arity); 530 ReplaceWithRuntimeCall(node, function, arity);
540 return node; 531 return node;
541 } 532 }
542 } 533 }
543 } 534 }
544 } // namespace v8::internal::compiler 535 } // namespace v8::internal::compiler
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698