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

Side by Side Diff: src/stub-cache.cc

Issue 12426008: Load/Store stub compilation refactoring. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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/macro-assembler-x64.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 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 1591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1602 __ bind(&miss); 1602 __ bind(&miss);
1603 TailCallBuiltin(masm(), MissBuiltin(kind())); 1603 TailCallBuiltin(masm(), MissBuiltin(kind()));
1604 1604
1605 // Return the generated code. 1605 // Return the generated code.
1606 return GetICCode(kind(), 1606 return GetICCode(kind(),
1607 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION, 1607 transition.is_null() ? Code::FIELD : Code::MAP_TRANSITION,
1608 name); 1608 name);
1609 } 1609 }
1610 1610
1611 1611
1612 Handle<Code> StoreStubCompiler::CompileStoreViaSetter(
1613 Handle<Name> name,
1614 Handle<JSObject> object,
1615 Handle<JSObject> holder,
1616 Handle<JSFunction> setter) {
1617 Label miss, miss_restore_name;
1618
1619 // Check that the maps haven't changed, preserving the name register.
1620 __ JumpIfSmi(receiver(), &miss);
1621 CheckPrototypes(object, receiver(), holder,
1622 this->name(), scratch1(), scratch2(),
1623 name, &miss_restore_name);
1624
1625 GenerateStoreViaSetter(masm(), setter);
1626
1627 GenerateRestoreName(masm(), &miss_restore_name, name);
ulan 2013/03/15 08:28:21 Restore removed new line before bind(miss).
Toon Verwaest 2013/03/15 12:07:17 Done.
1628 __ bind(&miss);
1629 TailCallBuiltin(masm(), MissBuiltin(kind()));
1630
1631 // Return the generated code.
1632 return GetICCode(kind(), Code::CALLBACKS, name);
1633 }
1634
1635
1636 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
1637 Handle<Map> receiver_map) {
1638 ElementsKind elements_kind = receiver_map->elements_kind();
1639 if (receiver_map->has_fast_elements() ||
1640 receiver_map->has_external_array_elements()) {
1641 Handle<Code> stub = KeyedLoadFastElementStub(
1642 receiver_map->instance_type() == JS_ARRAY_TYPE,
1643 elements_kind).GetCode(isolate());
1644 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1645 } else {
1646 Handle<Code> stub =
1647 KeyedLoadDictionaryElementStub().GetCode(isolate());
1648 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1649 }
1650
1651 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss);
1652
1653 // Return the generated code.
1654 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1655 }
1656
1657
1658 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement(
1659 Handle<Map> receiver_map) {
1660 ElementsKind elements_kind = receiver_map->elements_kind();
1661 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
1662 Handle<Code> stub =
1663 KeyedStoreElementStub(is_jsarray,
1664 elements_kind,
1665 store_mode_).GetCode(isolate());
1666
1667 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1668
1669 TailCallBuiltin(masm(), MissBuiltin(kind()));
ulan 2013/03/15 08:28:21 As discussed offline: Builtins::kKeyedStoreIC_Miss
Toon Verwaest 2013/03/15 12:07:17 Done.
1670
1671 // Return the generated code.
1672 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1673 }
1674
1675
1612 #undef __ 1676 #undef __
1613 1677
1614 1678
1615 void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) { 1679 void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) {
1616 Handle<Code> code(masm->isolate()->builtins()->builtin(name)); 1680 Handle<Code> code(masm->isolate()->builtins()->builtin(name));
1617 GenerateTailCall(masm, code); 1681 GenerateTailCall(masm, code);
1618 } 1682 }
1619 1683
1620 1684
1621 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { 1685 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 Handle<FunctionTemplateInfo>( 1986 Handle<FunctionTemplateInfo>(
1923 FunctionTemplateInfo::cast(signature->receiver())); 1987 FunctionTemplateInfo::cast(signature->receiver()));
1924 } 1988 }
1925 } 1989 }
1926 1990
1927 is_simple_api_call_ = true; 1991 is_simple_api_call_ = true;
1928 } 1992 }
1929 1993
1930 1994
1931 } } // namespace v8::internal 1995 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/macro-assembler-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698