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

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);
1628
1629 __ bind(&miss);
1630 TailCallBuiltin(masm(), MissBuiltin(kind()));
1631
1632 // Return the generated code.
1633 return GetICCode(kind(), Code::CALLBACKS, name);
1634 }
1635
1636
1637 Handle<Code> KeyedLoadStubCompiler::CompileLoadElement(
1638 Handle<Map> receiver_map) {
1639 ElementsKind elements_kind = receiver_map->elements_kind();
1640 if (receiver_map->has_fast_elements() ||
1641 receiver_map->has_external_array_elements()) {
1642 Handle<Code> stub = KeyedLoadFastElementStub(
1643 receiver_map->instance_type() == JS_ARRAY_TYPE,
1644 elements_kind).GetCode(isolate());
1645 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1646 } else {
1647 Handle<Code> stub =
1648 KeyedLoadDictionaryElementStub().GetCode(isolate());
1649 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1650 }
1651
1652 TailCallBuiltin(masm(), Builtins::kKeyedLoadIC_Miss);
1653
1654 // Return the generated code.
1655 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1656 }
1657
1658
1659 Handle<Code> KeyedStoreStubCompiler::CompileStoreElement(
1660 Handle<Map> receiver_map) {
1661 ElementsKind elements_kind = receiver_map->elements_kind();
1662 bool is_jsarray = receiver_map->instance_type() == JS_ARRAY_TYPE;
1663 Handle<Code> stub =
1664 KeyedStoreElementStub(is_jsarray,
1665 elements_kind,
1666 store_mode_).GetCode(isolate());
1667
1668 __ DispatchMap(receiver(), scratch1(), receiver_map, stub, DO_SMI_CHECK);
1669
1670 TailCallBuiltin(masm(), Builtins::kKeyedStoreIC_Miss);
1671
1672 // Return the generated code.
1673 return GetICCode(kind(), Code::NORMAL, factory()->empty_string());
1674 }
1675
1676
1612 #undef __ 1677 #undef __
1613 1678
1614 1679
1615 void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) { 1680 void StubCompiler::TailCallBuiltin(MacroAssembler* masm, Builtins::Name name) {
1616 Handle<Code> code(masm->isolate()->builtins()->builtin(name)); 1681 Handle<Code> code(masm->isolate()->builtins()->builtin(name));
1617 GenerateTailCall(masm, code); 1682 GenerateTailCall(masm, code);
1618 } 1683 }
1619 1684
1620 1685
1621 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) { 1686 void LoadStubCompiler::JitEvent(Handle<Name> name, Handle<Code> code) {
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 Handle<FunctionTemplateInfo>( 1987 Handle<FunctionTemplateInfo>(
1923 FunctionTemplateInfo::cast(signature->receiver())); 1988 FunctionTemplateInfo::cast(signature->receiver()));
1924 } 1989 }
1925 } 1990 }
1926 1991
1927 is_simple_api_call_ = true; 1992 is_simple_api_call_ = true;
1928 } 1993 }
1929 1994
1930 1995
1931 } } // namespace v8::internal 1996 } } // 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