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

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

Issue 6973001: Propagate a Failure from GenerateDictionaryNegativeLookup instead of causing GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 7 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/arm/macro-assembler-arm.cc ('k') | src/ia32/code-stubs-ia32.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // Miss: fall through. 88 // Miss: fall through.
89 __ bind(&miss); 89 __ bind(&miss);
90 } 90 }
91 91
92 92
93 // Helper function used to check that the dictionary doesn't contain 93 // Helper function used to check that the dictionary doesn't contain
94 // the property. This function may return false negatives, so miss_label 94 // the property. This function may return false negatives, so miss_label
95 // must always call a backup property check that is complete. 95 // must always call a backup property check that is complete.
96 // This function is safe to call if the receiver has fast properties. 96 // This function is safe to call if the receiver has fast properties.
97 // Name must be a symbol and receiver must be a heap object. 97 // Name must be a symbol and receiver must be a heap object.
98 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 98 MUST_USE_RESULT static MaybeObject* GenerateDictionaryNegativeLookup(
99 Label* miss_label, 99 MacroAssembler* masm,
100 Register receiver, 100 Label* miss_label,
101 String* name, 101 Register receiver,
102 Register scratch0, 102 String* name,
103 Register scratch1) { 103 Register scratch0,
104 Register scratch1) {
104 ASSERT(name->IsSymbol()); 105 ASSERT(name->IsSymbol());
105 Counters* counters = masm->isolate()->counters(); 106 Counters* counters = masm->isolate()->counters();
106 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); 107 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
107 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 108 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
108 109
109 Label done; 110 Label done;
110 111
111 const int kInterceptorOrAccessCheckNeededMask = 112 const int kInterceptorOrAccessCheckNeededMask =
112 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 113 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
113 114
(...skipping 16 matching lines...) Expand all
130 __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset)); 131 __ ldr(map, FieldMemOperand(properties, HeapObject::kMapOffset));
131 Register tmp = properties; 132 Register tmp = properties;
132 __ LoadRoot(tmp, Heap::kHashTableMapRootIndex); 133 __ LoadRoot(tmp, Heap::kHashTableMapRootIndex);
133 __ cmp(map, tmp); 134 __ cmp(map, tmp);
134 __ b(ne, miss_label); 135 __ b(ne, miss_label);
135 136
136 // Restore the temporarily used register. 137 // Restore the temporarily used register.
137 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset)); 138 __ ldr(properties, FieldMemOperand(receiver, JSObject::kPropertiesOffset));
138 139
139 140
140 StringDictionaryLookupStub::GenerateNegativeLookup(masm, 141 MaybeObject* result = StringDictionaryLookupStub::GenerateNegativeLookup(
141 miss_label, 142 masm,
142 &done, 143 miss_label,
143 receiver, 144 &done,
144 properties, 145 receiver,
145 name, 146 properties,
146 scratch1); 147 name,
148 scratch1);
149 if (result->IsFailure()) return result;
147 150
148 __ bind(&done); 151 __ bind(&done);
149 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 152 __ DecrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
153
154 return result;
150 } 155 }
151 156
152 157
153 void StubCache::GenerateProbe(MacroAssembler* masm, 158 void StubCache::GenerateProbe(MacroAssembler* masm,
154 Code::Flags flags, 159 Code::Flags flags,
155 Register receiver, 160 Register receiver,
156 Register name, 161 Register name,
157 Register scratch, 162 Register scratch,
158 Register extra, 163 Register extra,
159 Register extra2) { 164 Register extra2) {
(...skipping 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 Object* lookup_result = NULL; // Initialization to please compiler. 1046 Object* lookup_result = NULL; // Initialization to please compiler.
1042 if (!maybe_lookup_result->ToObject(&lookup_result)) { 1047 if (!maybe_lookup_result->ToObject(&lookup_result)) {
1043 set_failure(Failure::cast(maybe_lookup_result)); 1048 set_failure(Failure::cast(maybe_lookup_result));
1044 return reg; 1049 return reg;
1045 } 1050 }
1046 name = String::cast(lookup_result); 1051 name = String::cast(lookup_result);
1047 } 1052 }
1048 ASSERT(current->property_dictionary()->FindEntry(name) == 1053 ASSERT(current->property_dictionary()->FindEntry(name) ==
1049 StringDictionary::kNotFound); 1054 StringDictionary::kNotFound);
1050 1055
1051 GenerateDictionaryNegativeLookup(masm(), 1056 MaybeObject* negative_lookup = GenerateDictionaryNegativeLookup(masm(),
1052 miss, 1057 miss,
1053 reg, 1058 reg,
1054 name, 1059 name,
1055 scratch1, 1060 scratch1,
1056 scratch2); 1061 scratch2);
1062 if (negative_lookup->IsFailure()) {
1063 set_failure(Failure::cast(negative_lookup));
1064 return reg;
1065 }
1066
1057 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); 1067 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
1058 reg = holder_reg; // from now the object is in holder_reg 1068 reg = holder_reg; // from now the object is in holder_reg
1059 __ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset)); 1069 __ ldr(reg, FieldMemOperand(scratch1, Map::kPrototypeOffset));
1060 } else if (heap()->InNewSpace(prototype)) { 1070 } else if (heap()->InNewSpace(prototype)) {
1061 // Get the map of the current object. 1071 // Get the map of the current object.
1062 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset)); 1072 __ ldr(scratch1, FieldMemOperand(reg, HeapObject::kMapOffset));
1063 __ cmp(scratch1, Operand(Handle<Map>(current->map()))); 1073 __ cmp(scratch1, Operand(Handle<Map>(current->map())));
1064 1074
1065 // Branch on the result of the map check. 1075 // Branch on the result of the map check.
1066 __ b(ne, miss); 1076 __ b(ne, miss);
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after
4043 4053
4044 return GetCode(flags); 4054 return GetCode(flags);
4045 } 4055 }
4046 4056
4047 4057
4048 #undef __ 4058 #undef __
4049 4059
4050 } } // namespace v8::internal 4060 } } // namespace v8::internal
4051 4061
4052 #endif // V8_TARGET_ARCH_ARM 4062 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/ia32/code-stubs-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698