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

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

Issue 10828303: Fix improved LoadICs for dictionaries with callbacks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported to all architectures and addressed comments. Created 8 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/x64/ic-x64.cc ('k') | test/cctest/test-api.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 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 1030
1031 1031
1032 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver, 1032 void StubCompiler::GenerateDictionaryLoadCallback(Register receiver,
1033 Register name_reg, 1033 Register name_reg,
1034 Register scratch1, 1034 Register scratch1,
1035 Register scratch2, 1035 Register scratch2,
1036 Register scratch3, 1036 Register scratch3,
1037 Handle<AccessorInfo> callback, 1037 Handle<AccessorInfo> callback,
1038 Handle<String> name, 1038 Handle<String> name,
1039 Label* miss) { 1039 Label* miss) {
1040 ASSERT(!receiver.is(scratch1));
1041 ASSERT(!receiver.is(scratch2));
1042 ASSERT(!receiver.is(scratch3));
1043
1044 // Load the properties dictionary.
1040 Register dictionary = scratch1; 1045 Register dictionary = scratch1;
1041 __ movq(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset)); 1046 __ movq(dictionary, FieldOperand(receiver, JSObject::kPropertiesOffset));
1042 1047
1043 // Probe the dictionary. 1048 // Probe the dictionary.
1044 Label probe_done; 1049 Label probe_done;
1045 StringDictionaryLookupStub::GeneratePositiveLookup(masm(), 1050 StringDictionaryLookupStub::GeneratePositiveLookup(masm(),
1046 miss, 1051 miss,
1047 &probe_done, 1052 &probe_done,
1048 dictionary, 1053 dictionary,
1049 name_reg, 1054 name_reg,
1050 scratch2, 1055 scratch2,
1051 scratch3); 1056 scratch3);
1052 __ bind(&probe_done); 1057 __ bind(&probe_done);
1053 1058
1054 // If probing finds an entry in the dictionary, scratch2 contains the 1059 // If probing finds an entry in the dictionary, scratch3 contains the
1055 // index into the dictionary. Check that the value is the callback. 1060 // index into the dictionary. Check that the value is the callback.
1056 Register index = scratch2; 1061 Register index = scratch3;
1057 const int kElementsStartOffset = 1062 const int kElementsStartOffset =
1058 StringDictionary::kHeaderSize + 1063 StringDictionary::kHeaderSize +
1059 StringDictionary::kElementsStartIndex * kPointerSize; 1064 StringDictionary::kElementsStartIndex * kPointerSize;
1060 const int kValueOffset = kElementsStartOffset + kPointerSize; 1065 const int kValueOffset = kElementsStartOffset + kPointerSize;
1061 __ movq(scratch3, 1066 __ movq(scratch2,
1062 Operand(dictionary, index, times_8, kValueOffset - kHeapObjectTag)); 1067 Operand(dictionary, index, times_pointer_size,
1063 __ movq(scratch2, callback, RelocInfo::EMBEDDED_OBJECT); 1068 kValueOffset - kHeapObjectTag));
1064 __ cmpq(scratch3, scratch2); 1069 __ movq(scratch3, callback, RelocInfo::EMBEDDED_OBJECT);
1070 __ cmpq(scratch2, scratch3);
1065 __ j(not_equal, miss); 1071 __ j(not_equal, miss);
1066 } 1072 }
1067 1073
1068 1074
1069 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object, 1075 void StubCompiler::GenerateLoadCallback(Handle<JSObject> object,
1070 Handle<JSObject> holder, 1076 Handle<JSObject> holder,
1071 Register receiver, 1077 Register receiver,
1072 Register name_reg, 1078 Register name_reg,
1073 Register scratch1, 1079 Register scratch1,
1074 Register scratch2, 1080 Register scratch2,
1075 Register scratch3, 1081 Register scratch3,
1082 Register scratch4,
1076 Handle<AccessorInfo> callback, 1083 Handle<AccessorInfo> callback,
1077 Handle<String> name, 1084 Handle<String> name,
1078 Label* miss) { 1085 Label* miss) {
1079 // Check that the receiver isn't a smi. 1086 // Check that the receiver isn't a smi.
1080 __ JumpIfSmi(receiver, miss); 1087 __ JumpIfSmi(receiver, miss);
1081 1088
1082 // Check that the maps haven't changed. 1089 // Check that the maps haven't changed.
1083 Register reg = CheckPrototypes(object, receiver, holder, scratch1, 1090 Register reg = CheckPrototypes(object, receiver, holder, scratch1,
1084 scratch2, scratch3, name, miss); 1091 scratch2, scratch3, name, miss);
1085 1092
1086 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { 1093 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) {
1087 GenerateDictionaryLoadCallback( 1094 GenerateDictionaryLoadCallback(
1088 receiver, name_reg, scratch1, scratch2, scratch3, callback, name, miss); 1095 reg, name_reg, scratch2, scratch3, scratch4, callback, name, miss);
1089 } 1096 }
1090 1097
1091 // Insert additional parameters into the stack frame above return address. 1098 // Insert additional parameters into the stack frame above return address.
1092 ASSERT(!scratch2.is(reg)); 1099 ASSERT(!scratch2.is(reg));
1093 __ pop(scratch2); // Get return address to place it below. 1100 __ pop(scratch2); // Get return address to place it below.
1094 1101
1095 __ push(receiver); // receiver 1102 __ push(receiver); // receiver
1096 __ push(reg); // holder 1103 __ push(reg); // holder
1097 if (heap()->InNewSpace(callback->data())) { 1104 if (heap()->InNewSpace(callback->data())) {
1098 __ Move(scratch1, callback); 1105 __ Move(scratch1, callback);
(...skipping 1675 matching lines...) Expand 10 before | Expand all | Expand 10 after
2774 Handle<String> name, 2781 Handle<String> name,
2775 Handle<JSObject> object, 2782 Handle<JSObject> object,
2776 Handle<JSObject> holder, 2783 Handle<JSObject> holder,
2777 Handle<AccessorInfo> callback) { 2784 Handle<AccessorInfo> callback) {
2778 // ----------- S t a t e ------------- 2785 // ----------- S t a t e -------------
2779 // -- rax : receiver 2786 // -- rax : receiver
2780 // -- rcx : name 2787 // -- rcx : name
2781 // -- rsp[0] : return address 2788 // -- rsp[0] : return address
2782 // ----------------------------------- 2789 // -----------------------------------
2783 Label miss; 2790 Label miss;
2784 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, callback, 2791 GenerateLoadCallback(object, holder, rax, rcx, rdx, rbx, rdi, r8, callback,
2785 name, &miss); 2792 name, &miss);
2786 __ bind(&miss); 2793 __ bind(&miss);
2787 GenerateLoadMiss(masm(), Code::LOAD_IC); 2794 GenerateLoadMiss(masm(), Code::LOAD_IC);
2788 2795
2789 // Return the generated code. 2796 // Return the generated code.
2790 return GetCode(Code::CALLBACKS, name); 2797 return GetCode(Code::CALLBACKS, name);
2791 } 2798 }
2792 2799
2793 2800
2794 Handle<Code> LoadStubCompiler::CompileLoadViaGetter( 2801 Handle<Code> LoadStubCompiler::CompileLoadViaGetter(
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
2957 // -- rsp[0] : return address 2964 // -- rsp[0] : return address
2958 // ----------------------------------- 2965 // -----------------------------------
2959 Label miss; 2966 Label miss;
2960 Counters* counters = isolate()->counters(); 2967 Counters* counters = isolate()->counters();
2961 __ IncrementCounter(counters->keyed_load_callback(), 1); 2968 __ IncrementCounter(counters->keyed_load_callback(), 1);
2962 2969
2963 // Check that the name has not changed. 2970 // Check that the name has not changed.
2964 __ Cmp(rax, name); 2971 __ Cmp(rax, name);
2965 __ j(not_equal, &miss); 2972 __ j(not_equal, &miss);
2966 2973
2967 GenerateLoadCallback(receiver, holder, rdx, rax, rbx, rcx, rdi, callback, 2974 GenerateLoadCallback(receiver, holder, rdx, rax, rbx, rcx, rdi, r8, callback,
2968 name, &miss); 2975 name, &miss);
2969 __ bind(&miss); 2976 __ bind(&miss);
2970 __ DecrementCounter(counters->keyed_load_callback(), 1); 2977 __ DecrementCounter(counters->keyed_load_callback(), 1);
2971 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2978 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2972 2979
2973 // Return the generated code. 2980 // Return the generated code.
2974 return GetCode(Code::CALLBACKS, name); 2981 return GetCode(Code::CALLBACKS, name);
2975 } 2982 }
2976 2983
2977 2984
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
4043 __ jmp(ic_slow, RelocInfo::CODE_TARGET); 4050 __ jmp(ic_slow, RelocInfo::CODE_TARGET);
4044 } 4051 }
4045 } 4052 }
4046 4053
4047 4054
4048 #undef __ 4055 #undef __
4049 4056
4050 } } // namespace v8::internal 4057 } } // namespace v8::internal
4051 4058
4052 #endif // V8_TARGET_ARCH_X64 4059 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/ic-x64.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698