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

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

Issue 460623002: Revert "More lazy deoptimization in Turbofan (binops, loads/stores)" (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 | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/js-operator.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 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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 UNIMPLEMENTED(); \ 285 UNIMPLEMENTED(); \
286 return node; \ 286 return node; \
287 } 287 }
288 REPLACE_UNIMPLEMENTED(JSToString) 288 REPLACE_UNIMPLEMENTED(JSToString)
289 REPLACE_UNIMPLEMENTED(JSToName) 289 REPLACE_UNIMPLEMENTED(JSToName)
290 REPLACE_UNIMPLEMENTED(JSYield) 290 REPLACE_UNIMPLEMENTED(JSYield)
291 REPLACE_UNIMPLEMENTED(JSDebugger) 291 REPLACE_UNIMPLEMENTED(JSDebugger)
292 #undef REPLACE_UNIMPLEMENTED 292 #undef REPLACE_UNIMPLEMENTED
293 293
294 294
295 static CallDescriptor::DeoptimizationSupport DeoptimizationSupportForNode(
296 Node* node) {
297 return OperatorProperties::CanLazilyDeoptimize(node->op())
298 ? CallDescriptor::kCanDeoptimize
299 : CallDescriptor::kCannotDeoptimize;
300 }
301
302
303 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token, 295 void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token,
304 bool pure) { 296 bool pure) {
305 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack. 297 BinaryOpICStub stub(isolate(), Token::ADD); // TODO(mstarzinger): Hack.
306 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor(); 298 CodeStubInterfaceDescriptor* d = stub.GetInterfaceDescriptor();
307 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(d); 299 CallDescriptor* desc_compare = linkage()->GetStubCallDescriptor(d);
308 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token); 300 Handle<Code> ic = CompareIC::GetUninitialized(isolate(), token);
309 Node* compare; 301 Node* compare;
310 if (pure) { 302 if (pure) {
311 // A pure (strict) comparison doesn't have an effect or control. 303 // A pure (strict) comparison doesn't have an effect or control.
312 // But for the graph, we need to add these inputs. 304 // But for the graph, we need to add these inputs.
(...skipping 12 matching lines...) Expand all
325 } 317 }
326 node->ReplaceInput(0, compare); 318 node->ReplaceInput(0, compare);
327 node->ReplaceInput(1, SmiConstant(token)); 319 node->ReplaceInput(1, SmiConstant(token));
328 ReplaceWithRuntimeCall(node, Runtime::kBooleanize); 320 ReplaceWithRuntimeCall(node, Runtime::kBooleanize);
329 } 321 }
330 322
331 323
332 void JSGenericLowering::ReplaceWithICStubCall(Node* node, 324 void JSGenericLowering::ReplaceWithICStubCall(Node* node,
333 HydrogenCodeStub* stub) { 325 HydrogenCodeStub* stub) {
334 CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor(); 326 CodeStubInterfaceDescriptor* d = stub->GetInterfaceDescriptor();
335 CallDescriptor* desc = linkage()->GetStubCallDescriptor( 327 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d);
336 d, 0, DeoptimizationSupportForNode(node));
337 Node* stub_code = CodeConstant(stub->GetCode()); 328 Node* stub_code = CodeConstant(stub->GetCode());
338 PatchInsertInput(node, 0, stub_code); 329 PatchInsertInput(node, 0, stub_code);
339 PatchOperator(node, common()->Call(desc)); 330 PatchOperator(node, common()->Call(desc));
340 } 331 }
341 332
342 333
343 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node, 334 void JSGenericLowering::ReplaceWithBuiltinCall(Node* node,
344 Builtins::JavaScript id, 335 Builtins::JavaScript id,
345 int nargs) { 336 int nargs) {
346 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS); 337 CallFunctionStub stub(isolate(), nargs - 1, NO_CALL_FUNCTION_FLAGS);
(...skipping 10 matching lines...) Expand all
357 PatchOperator(node, common()->Call(desc)); 348 PatchOperator(node, common()->Call(desc));
358 } 349 }
359 350
360 351
361 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node, 352 void JSGenericLowering::ReplaceWithRuntimeCall(Node* node,
362 Runtime::FunctionId f, 353 Runtime::FunctionId f,
363 int nargs_override) { 354 int nargs_override) {
364 Operator::Property props = node->op()->properties(); 355 Operator::Property props = node->op()->properties();
365 const Runtime::Function* fun = Runtime::FunctionForId(f); 356 const Runtime::Function* fun = Runtime::FunctionForId(f);
366 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override; 357 int nargs = (nargs_override < 0) ? fun->nargs : nargs_override;
367 CallDescriptor* desc = linkage()->GetRuntimeCallDescriptor( 358 CallDescriptor::DeoptimizationSupport deopt =
368 f, nargs, props, DeoptimizationSupportForNode(node)); 359 OperatorProperties::CanLazilyDeoptimize(node->op())
360 ? CallDescriptor::kCanDeoptimize
361 : CallDescriptor::kCannotDeoptimize;
362 CallDescriptor* desc =
363 linkage()->GetRuntimeCallDescriptor(f, nargs, props, deopt);
369 Node* ref = ExternalConstant(ExternalReference(f, isolate())); 364 Node* ref = ExternalConstant(ExternalReference(f, isolate()));
370 Node* arity = Int32Constant(nargs); 365 Node* arity = Int32Constant(nargs);
371 if (!centrystub_constant_.is_set()) { 366 if (!centrystub_constant_.is_set()) {
372 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode())); 367 centrystub_constant_.set(CodeConstant(CEntryStub(isolate(), 1).GetCode()));
373 } 368 }
374 PatchInsertInput(node, 0, centrystub_constant_.get()); 369 PatchInsertInput(node, 0, centrystub_constant_.get());
375 PatchInsertInput(node, nargs + 1, ref); 370 PatchInsertInput(node, nargs + 1, ref);
376 PatchInsertInput(node, nargs + 2, arity); 371 PatchInsertInput(node, nargs + 2, arity);
377 PatchOperator(node, common()->Call(desc)); 372 PatchOperator(node, common()->Call(desc));
378 } 373 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 501 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
507 PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier)); 502 PatchOperator(node, machine()->Store(kMachineTagged, kFullWriteBarrier));
508 return node; 503 return node;
509 } 504 }
510 505
511 506
512 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) { 507 Node* JSGenericLowering::LowerJSCallConstruct(Node* node) {
513 int arity = OpParameter<int>(node); 508 int arity = OpParameter<int>(node);
514 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); 509 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
515 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); 510 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
516 CallDescriptor* desc = linkage()->GetStubCallDescriptor( 511 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, arity);
517 d, arity, DeoptimizationSupportForNode(node));
518 Node* stub_code = CodeConstant(stub.GetCode()); 512 Node* stub_code = CodeConstant(stub.GetCode());
519 Node* construct = NodeProperties::GetValueInput(node, 0); 513 Node* construct = NodeProperties::GetValueInput(node, 0);
520 PatchInsertInput(node, 0, stub_code); 514 PatchInsertInput(node, 0, stub_code);
521 PatchInsertInput(node, 1, Int32Constant(arity - 1)); 515 PatchInsertInput(node, 1, Int32Constant(arity - 1));
522 PatchInsertInput(node, 2, construct); 516 PatchInsertInput(node, 2, construct);
523 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); 517 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
524 PatchOperator(node, common()->Call(desc)); 518 PatchOperator(node, common()->Call(desc));
525 return node; 519 return node;
526 } 520 }
527 521
528 522
529 Node* JSGenericLowering::LowerJSCallFunction(Node* node) { 523 Node* JSGenericLowering::LowerJSCallFunction(Node* node) {
530 CallParameters p = OpParameter<CallParameters>(node); 524 CallParameters p = OpParameter<CallParameters>(node);
531 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); 525 CallFunctionStub stub(isolate(), p.arity - 2, p.flags);
532 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub); 526 CodeStubInterfaceDescriptor* d = GetInterfaceDescriptor(isolate(), &stub);
533 CallDescriptor* desc = linkage()->GetStubCallDescriptor( 527 CallDescriptor* desc = linkage()->GetStubCallDescriptor(d, p.arity - 1);
534 d, p.arity - 1, DeoptimizationSupportForNode(node));
535 Node* stub_code = CodeConstant(stub.GetCode()); 528 Node* stub_code = CodeConstant(stub.GetCode());
536 PatchInsertInput(node, 0, stub_code); 529 PatchInsertInput(node, 0, stub_code);
537 PatchOperator(node, common()->Call(desc)); 530 PatchOperator(node, common()->Call(desc));
538 return node; 531 return node;
539 } 532 }
540 533
541 534
542 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) { 535 Node* JSGenericLowering::LowerJSCallRuntime(Node* node) {
543 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 536 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node);
544 int arity = OperatorProperties::GetValueInputCount(node->op()); 537 int arity = OperatorProperties::GetValueInputCount(node->op());
545 ReplaceWithRuntimeCall(node, function, arity); 538 ReplaceWithRuntimeCall(node, function, arity);
546 return node; 539 return node;
547 } 540 }
548 } 541 }
549 } 542 }
550 } // namespace v8::internal::compiler 543 } // namespace v8::internal::compiler
OLDNEW
« no previous file with comments | « src/compiler/ia32/linkage-ia32.cc ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698