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/stub-cache.cc

Issue 14063006: Disentangle field from transition stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 8 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/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 Handle<Code> handler = 395 Handle<Code> handler =
396 compiler.CompileLoadCallback(receiver, holder, name, callback); 396 compiler.CompileLoadCallback(receiver, holder, name, callback);
397 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 397 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
398 return handler; 398 return handler;
399 } 399 }
400 400
401 401
402 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name, 402 Handle<Code> StubCache::ComputeStoreField(Handle<Name> name,
403 Handle<JSObject> receiver, 403 Handle<JSObject> receiver,
404 LookupResult* lookup, 404 LookupResult* lookup,
405 Handle<Map> transition,
406 StrictModeFlag strict_mode) { 405 StrictModeFlag strict_mode) {
407 Code::StubType type = 406 Handle<Code> stub = FindIC(
408 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION; 407 name, receiver, Code::STORE_IC, Code::FIELD, strict_mode);
408 if (!stub.is_null()) return stub;
409 409
410 StoreStubCompiler compiler(isolate_, strict_mode);
411 Handle<Code> code = compiler.CompileStoreField(receiver, lookup, name);
412 JSObject::UpdateMapCodeCache(receiver, name, code);
413 return code;
414 }
415
416
417 Handle<Code> StubCache::ComputeStoreTransition(Handle<Name> name,
418 Handle<JSObject> receiver,
419 LookupResult* lookup,
420 Handle<Map> transition,
421 StrictModeFlag strict_mode) {
410 Handle<Code> stub = FindIC( 422 Handle<Code> stub = FindIC(
411 name, receiver, Code::STORE_IC, type, strict_mode); 423 name, receiver, Code::STORE_IC, Code::MAP_TRANSITION, strict_mode);
412 if (!stub.is_null()) return stub; 424 if (!stub.is_null()) return stub;
413 425
414 StoreStubCompiler compiler(isolate_, strict_mode); 426 StoreStubCompiler compiler(isolate_, strict_mode);
415 Handle<Code> code = 427 Handle<Code> code =
416 compiler.CompileStoreField(receiver, lookup, transition, name); 428 compiler.CompileStoreTransition(receiver, lookup, transition, name);
417 JSObject::UpdateMapCodeCache(receiver, name, code); 429 JSObject::UpdateMapCodeCache(receiver, name, code);
418 return code; 430 return code;
419 } 431 }
420 432
421 433
422 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) { 434 Handle<Code> StubCache::ComputeKeyedLoadElement(Handle<Map> receiver_map) {
423 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC); 435 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC);
424 Handle<Name> name = 436 Handle<Name> name =
425 isolate()->factory()->KeyedLoadElementMonomorphic_string(); 437 isolate()->factory()->KeyedLoadElementMonomorphic_string();
426 438
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 Handle<Code> stub = FindIC( 539 Handle<Code> stub = FindIC(
528 name, receiver, Code::STORE_IC, Code::INTERCEPTOR, strict_mode); 540 name, receiver, Code::STORE_IC, Code::INTERCEPTOR, strict_mode);
529 if (!stub.is_null()) return stub; 541 if (!stub.is_null()) return stub;
530 542
531 StoreStubCompiler compiler(isolate_, strict_mode); 543 StoreStubCompiler compiler(isolate_, strict_mode);
532 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); 544 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name);
533 JSObject::UpdateMapCodeCache(receiver, name, code); 545 JSObject::UpdateMapCodeCache(receiver, name, code);
534 return code; 546 return code;
535 } 547 }
536 548
549
537 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name, 550 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<Name> name,
538 Handle<JSObject> receiver, 551 Handle<JSObject> receiver,
539 LookupResult* lookup, 552 LookupResult* lookup,
540 Handle<Map> transition,
541 StrictModeFlag strict_mode) { 553 StrictModeFlag strict_mode) {
542 Code::StubType type =
543 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION;
544 Handle<Code> stub = FindIC( 554 Handle<Code> stub = FindIC(
545 name, receiver, Code::KEYED_STORE_IC, type, strict_mode); 555 name, receiver, Code::KEYED_STORE_IC, Code::FIELD, strict_mode);
556 if (!stub.is_null()) return stub;
557
558 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
559 Handle<Code> code = compiler.CompileStoreField(receiver, lookup, name);
560 JSObject::UpdateMapCodeCache(receiver, name, code);
561 return code;
562 }
563
564
565 Handle<Code> StubCache::ComputeKeyedStoreTransition(
566 Handle<Name> name,
567 Handle<JSObject> receiver,
568 LookupResult* lookup,
569 Handle<Map> transition,
570 StrictModeFlag strict_mode) {
571 Handle<Code> stub = FindIC(
572 name, receiver, Code::KEYED_STORE_IC, Code::MAP_TRANSITION, strict_mode);
546 if (!stub.is_null()) return stub; 573 if (!stub.is_null()) return stub;
547 574
548 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE); 575 KeyedStoreStubCompiler compiler(isolate(), strict_mode, STANDARD_STORE);
549 Handle<Code> code = 576 Handle<Code> code =
550 compiler.CompileStoreField(receiver, lookup, transition, name); 577 compiler.CompileStoreTransition(receiver, lookup, transition, name);
551 JSObject::UpdateMapCodeCache(receiver, name, code); 578 JSObject::UpdateMapCodeCache(receiver, name, code);
552 return code; 579 return code;
553 } 580 }
554 581
555 582
556 #define CALL_LOGGER_TAG(kind, type) \ 583 #define CALL_LOGGER_TAG(kind, type) \
557 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) 584 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type)
558 585
559 Handle<Code> StubCache::ComputeCallConstant(int argc, 586 Handle<Code> StubCache::ComputeCallConstant(int argc,
560 Code::Kind kind, 587 Code::Kind kind,
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1580 HandlerFrontend(object, receiver(), holder, name, &success); 1607 HandlerFrontend(object, receiver(), holder, name, &success);
1581 1608
1582 __ bind(&success); 1609 __ bind(&success);
1583 GenerateLoadViaGetter(masm(), getter); 1610 GenerateLoadViaGetter(masm(), getter);
1584 1611
1585 // Return the generated code. 1612 // Return the generated code.
1586 return GetCode(kind(), Code::CALLBACKS, name); 1613 return GetCode(kind(), Code::CALLBACKS, name);
1587 } 1614 }
1588 1615
1589 1616
1617 Handle<Code> BaseStoreStubCompiler::CompileStoreTransition(
1618 Handle<JSObject> object,
1619 LookupResult* lookup,
1620 Handle<Map> transition,
1621 Handle<Name> name) {
1622 Label miss, miss_restore_name;
1623
1624 GenerateNameCheck(name, this->name(), &miss);
1625
1626 GenerateStoreTransition(masm(),
1627 object,
1628 lookup,
1629 transition,
1630 name,
1631 receiver(), this->name(), value(),
1632 scratch1(), scratch2(),
1633 &miss,
1634 &miss_restore_name);
1635
1636 // Handle store cache miss.
1637 GenerateRestoreName(masm(), &miss_restore_name, name);
1638 __ bind(&miss);
1639 TailCallBuiltin(masm(), MissBuiltin(kind()));
1640
1641 // Return the generated code.
1642 return GetICCode(kind(), Code::MAP_TRANSITION, name);
1643 }
1644
1645
1590 Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object, 1646 Handle<Code> BaseStoreStubCompiler::CompileStoreField(Handle<JSObject> object,
1591 LookupResult* lookup, 1647 LookupResult* lookup,
1592 Handle<Map> transition,
1593 Handle<Name> name) { 1648 Handle<Name> name) {
1594 Label miss, miss_restore_name; 1649 Label miss;
1595 1650
1596 GenerateNameCheck(name, this->name(), &miss); 1651 GenerateNameCheck(name, this->name(), &miss);
1597 1652
1598 // Generate store field code. 1653 // Generate store field code.
1599 GenerateStoreField(masm(), 1654 GenerateStoreField(masm(),
1600 object, 1655 object,
1601 lookup, 1656 lookup,
1602 transition,
1603 name,
1604 receiver(), this->name(), value(), scratch1(), scratch2(), 1657 receiver(), this->name(), value(), scratch1(), scratch2(),
1605 &miss, 1658 &miss);
1606 &miss_restore_name);
1607 1659
1608 // Handle store cache miss. 1660 // Handle store cache miss.
1609 GenerateRestoreName(masm(), &miss_restore_name, name);
1610 __ bind(&miss); 1661 __ bind(&miss);
1611 TailCallBuiltin(masm(), MissBuiltin(kind())); 1662 TailCallBuiltin(masm(), MissBuiltin(kind()));
1612 1663
1613 // Return the generated code. 1664 // Return the generated code.
1614 return GetICCode(kind(), 1665 return GetICCode(kind(), Code::FIELD, name);
1615 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION,
1616 name);
1617 } 1666 }
1618 1667
1619 1668
1620 Handle<Code> StoreStubCompiler::CompileStoreViaSetter( 1669 Handle<Code> StoreStubCompiler::CompileStoreViaSetter(
1621 Handle<Name> name, 1670 Handle<Name> name,
1622 Handle<JSObject> object, 1671 Handle<JSObject> object,
1623 Handle<JSObject> holder, 1672 Handle<JSObject> holder,
1624 Handle<JSFunction> setter) { 1673 Handle<JSFunction> setter) {
1625 Label miss, miss_restore_name; 1674 Label miss, miss_restore_name;
1626 1675
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
2013 Handle<FunctionTemplateInfo>( 2062 Handle<FunctionTemplateInfo>(
2014 FunctionTemplateInfo::cast(signature->receiver())); 2063 FunctionTemplateInfo::cast(signature->receiver()));
2015 } 2064 }
2016 } 2065 }
2017 2066
2018 is_simple_api_call_ = true; 2067 is_simple_api_call_ = true;
2019 } 2068 }
2020 2069
2021 2070
2022 } } // namespace v8::internal 2071 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698