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

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

Issue 613683002: [turbofan] Some javascript operators are globally shared singletons. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 2 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/js-generic-lowering.h ('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-factory.h" 5 #include "src/code-factory.h"
6 #include "src/code-stubs.h" 6 #include "src/code-stubs.h"
7 #include "src/compiler/common-operator.h" 7 #include "src/compiler/common-operator.h"
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-generic-lowering.h" 9 #include "src/compiler/js-generic-lowering.h"
10 #include "src/compiler/machine-operator.h" 10 #include "src/compiler/machine-operator.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 } 274 }
275 275
276 276
277 void JSGenericLowering::LowerJSLoadProperty(Node* node) { 277 void JSGenericLowering::LowerJSLoadProperty(Node* node) {
278 Callable callable = CodeFactory::KeyedLoadIC(isolate()); 278 Callable callable = CodeFactory::KeyedLoadIC(isolate());
279 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 279 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
280 } 280 }
281 281
282 282
283 void JSGenericLowering::LowerJSLoadNamed(Node* node) { 283 void JSGenericLowering::LowerJSLoadNamed(Node* node) {
284 LoadNamedParameters p = OpParameter<LoadNamedParameters>(node); 284 const LoadNamedParameters& p = LoadNamedParametersOf(node->op());
285 Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode); 285 Callable callable = CodeFactory::LoadIC(isolate(), p.contextual_mode());
286 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name)); 286 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name()));
287 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 287 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
288 } 288 }
289 289
290 290
291 void JSGenericLowering::LowerJSStoreProperty(Node* node) { 291 void JSGenericLowering::LowerJSStoreProperty(Node* node) {
292 StrictMode strict_mode = OpParameter<StrictMode>(node); 292 StrictMode strict_mode = OpParameter<StrictMode>(node);
293 Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode); 293 Callable callable = CodeFactory::KeyedStoreIC(isolate(), strict_mode);
294 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 294 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
295 } 295 }
296 296
297 297
298 void JSGenericLowering::LowerJSStoreNamed(Node* node) { 298 void JSGenericLowering::LowerJSStoreNamed(Node* node) {
299 StoreNamedParameters params = OpParameter<StoreNamedParameters>(node); 299 const StoreNamedParameters& p = StoreNamedParametersOf(node->op());
300 Callable callable = CodeFactory::StoreIC(isolate(), params.strict_mode); 300 Callable callable = CodeFactory::StoreIC(isolate(), p.strict_mode());
301 PatchInsertInput(node, 1, jsgraph()->HeapConstant(params.name)); 301 PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name()));
302 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite); 302 ReplaceWithStubCall(node, callable, CallDescriptor::kPatchableCallSite);
303 } 303 }
304 304
305 305
306 void JSGenericLowering::LowerJSDeleteProperty(Node* node) { 306 void JSGenericLowering::LowerJSDeleteProperty(Node* node) {
307 StrictMode strict_mode = OpParameter<StrictMode>(node); 307 StrictMode strict_mode = OpParameter<StrictMode>(node);
308 PatchInsertInput(node, 2, SmiConstant(strict_mode)); 308 PatchInsertInput(node, 2, SmiConstant(strict_mode));
309 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3); 309 ReplaceWithBuiltinCall(node, Builtins::DELETE, 3);
310 } 310 }
311 311
(...skipping 11 matching lines...) Expand all
323 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 323 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
324 CallDescriptor* desc = 324 CallDescriptor* desc =
325 linkage()->GetStubCallDescriptor(d, 0, FlagsForNode(node)); 325 linkage()->GetStubCallDescriptor(d, 0, FlagsForNode(node));
326 Node* stub_code = CodeConstant(stub.GetCode()); 326 Node* stub_code = CodeConstant(stub.GetCode());
327 PatchInsertInput(node, 0, stub_code); 327 PatchInsertInput(node, 0, stub_code);
328 PatchOperator(node, common()->Call(desc)); 328 PatchOperator(node, common()->Call(desc));
329 } 329 }
330 330
331 331
332 void JSGenericLowering::LowerJSLoadContext(Node* node) { 332 void JSGenericLowering::LowerJSLoadContext(Node* node) {
333 ContextAccess access = OpParameter<ContextAccess>(node); 333 const ContextAccess& access = ContextAccessOf(node->op());
334 // TODO(mstarzinger): Use simplified operators instead of machine operators 334 // TODO(mstarzinger): Use simplified operators instead of machine operators
335 // here so that load/store optimization can be applied afterwards. 335 // here so that load/store optimization can be applied afterwards.
336 for (int i = 0; i < access.depth(); ++i) { 336 for (size_t i = 0; i < access.depth(); ++i) {
337 node->ReplaceInput( 337 node->ReplaceInput(
338 0, graph()->NewNode( 338 0, graph()->NewNode(
339 machine()->Load(kMachAnyTagged), 339 machine()->Load(kMachAnyTagged),
340 NodeProperties::GetValueInput(node, 0), 340 NodeProperties::GetValueInput(node, 0),
341 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), 341 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
342 NodeProperties::GetEffectInput(node))); 342 NodeProperties::GetEffectInput(node)));
343 } 343 }
344 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 344 node->ReplaceInput(
345 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index()))));
345 PatchOperator(node, machine()->Load(kMachAnyTagged)); 346 PatchOperator(node, machine()->Load(kMachAnyTagged));
346 } 347 }
347 348
348 349
349 void JSGenericLowering::LowerJSStoreContext(Node* node) { 350 void JSGenericLowering::LowerJSStoreContext(Node* node) {
350 ContextAccess access = OpParameter<ContextAccess>(node); 351 const ContextAccess& access = ContextAccessOf(node->op());
351 // TODO(mstarzinger): Use simplified operators instead of machine operators 352 // TODO(mstarzinger): Use simplified operators instead of machine operators
352 // here so that load/store optimization can be applied afterwards. 353 // here so that load/store optimization can be applied afterwards.
353 for (int i = 0; i < access.depth(); ++i) { 354 for (size_t i = 0; i < access.depth(); ++i) {
354 node->ReplaceInput( 355 node->ReplaceInput(
355 0, graph()->NewNode( 356 0, graph()->NewNode(
356 machine()->Load(kMachAnyTagged), 357 machine()->Load(kMachAnyTagged),
357 NodeProperties::GetValueInput(node, 0), 358 NodeProperties::GetValueInput(node, 0),
358 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)), 359 Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
359 NodeProperties::GetEffectInput(node))); 360 NodeProperties::GetEffectInput(node)));
360 } 361 }
361 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1)); 362 node->ReplaceInput(2, NodeProperties::GetValueInput(node, 1));
362 node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index()))); 363 node->ReplaceInput(
364 1, Int32Constant(Context::SlotOffset(static_cast<int>(access.index()))));
363 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged, 365 PatchOperator(node, machine()->Store(StoreRepresentation(kMachAnyTagged,
364 kFullWriteBarrier))); 366 kFullWriteBarrier)));
365 } 367 }
366 368
367 369
368 void JSGenericLowering::LowerJSCallConstruct(Node* node) { 370 void JSGenericLowering::LowerJSCallConstruct(Node* node) {
369 int arity = OpParameter<int>(node); 371 int arity = OpParameter<int>(node);
370 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS); 372 CallConstructStub stub(isolate(), NO_CALL_CONSTRUCTOR_FLAGS);
371 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 373 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
372 CallDescriptor* desc = 374 CallDescriptor* desc =
373 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node)); 375 linkage()->GetStubCallDescriptor(d, arity, FlagsForNode(node));
374 Node* stub_code = CodeConstant(stub.GetCode()); 376 Node* stub_code = CodeConstant(stub.GetCode());
375 Node* construct = NodeProperties::GetValueInput(node, 0); 377 Node* construct = NodeProperties::GetValueInput(node, 0);
376 PatchInsertInput(node, 0, stub_code); 378 PatchInsertInput(node, 0, stub_code);
377 PatchInsertInput(node, 1, Int32Constant(arity - 1)); 379 PatchInsertInput(node, 1, Int32Constant(arity - 1));
378 PatchInsertInput(node, 2, construct); 380 PatchInsertInput(node, 2, construct);
379 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant()); 381 PatchInsertInput(node, 3, jsgraph()->UndefinedConstant());
380 PatchOperator(node, common()->Call(desc)); 382 PatchOperator(node, common()->Call(desc));
381 } 383 }
382 384
383 385
384 void JSGenericLowering::LowerJSCallFunction(Node* node) { 386 void JSGenericLowering::LowerJSCallFunction(Node* node) {
385 CallParameters p = OpParameter<CallParameters>(node); 387 const CallFunctionParameters& p = CallFunctionParametersOf(node->op());
386 CallFunctionStub stub(isolate(), p.arity - 2, p.flags); 388 CallFunctionStub stub(isolate(), static_cast<int>(p.arity() - 2), p.flags());
387 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor(); 389 CallInterfaceDescriptor d = stub.GetCallInterfaceDescriptor();
388 CallDescriptor* desc = 390 CallDescriptor* desc = linkage()->GetStubCallDescriptor(
389 linkage()->GetStubCallDescriptor(d, p.arity - 1, FlagsForNode(node)); 391 d, static_cast<int>(p.arity() - 1), FlagsForNode(node));
390 Node* stub_code = CodeConstant(stub.GetCode()); 392 Node* stub_code = CodeConstant(stub.GetCode());
391 PatchInsertInput(node, 0, stub_code); 393 PatchInsertInput(node, 0, stub_code);
392 PatchOperator(node, common()->Call(desc)); 394 PatchOperator(node, common()->Call(desc));
393 } 395 }
394 396
395 397
396 void JSGenericLowering::LowerJSCallRuntime(Node* node) { 398 void JSGenericLowering::LowerJSCallRuntime(Node* node) {
397 Runtime::FunctionId function = OpParameter<Runtime::FunctionId>(node); 399 const CallRuntimeParameters& p = CallRuntimeParametersOf(node->op());
398 int arity = OperatorProperties::GetValueInputCount(node->op()); 400 ReplaceWithRuntimeCall(node, p.id(), static_cast<int>(p.arity()));
399 ReplaceWithRuntimeCall(node, function, arity);
400 } 401 }
401 402
402 } // namespace compiler 403 } // namespace compiler
403 } // namespace internal 404 } // namespace internal
404 } // namespace v8 405 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-generic-lowering.h ('k') | src/compiler/js-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698