OLD | NEW |
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 *secondary = *primary; | 102 *secondary = *primary; |
103 } | 103 } |
104 | 104 |
105 // Update primary cache. | 105 // Update primary cache. |
106 primary->key = name; | 106 primary->key = name; |
107 primary->value = code; | 107 primary->value = code; |
108 return code; | 108 return code; |
109 } | 109 } |
110 | 110 |
111 | 111 |
112 MaybeObject* StubCache::ComputeLoadNonexistent(String* name, | 112 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(Handle<String> name, |
113 JSObject* receiver) { | 113 Handle<JSObject> object, |
| 114 Handle<JSObject> last) { |
| 115 CALL_HEAP_FUNCTION(isolate(), |
| 116 CompileLoadNonexistent(*name, *object, *last), |
| 117 Code); |
| 118 } |
| 119 |
| 120 |
| 121 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<String> name, |
| 122 Handle<JSObject> receiver) { |
114 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); | 123 ASSERT(receiver->IsGlobalObject() || receiver->HasFastProperties()); |
115 // If no global objects are present in the prototype chain, the load | 124 // If no global objects are present in the prototype chain, the load |
116 // nonexistent IC stub can be shared for all names for a given map | 125 // nonexistent IC stub can be shared for all names for a given map |
117 // and we use the empty string for the map cache in that case. If | 126 // and we use the empty string for the map cache in that case. If |
118 // there are global objects involved, we need to check global | 127 // there are global objects involved, we need to check global |
119 // property cells in the stub and therefore the stub will be | 128 // property cells in the stub and therefore the stub will be |
120 // specific to the name. | 129 // specific to the name. |
121 String* cache_name = heap()->empty_string(); | 130 Handle<String> cache_name = factory()->empty_string(); |
122 if (receiver->IsGlobalObject()) cache_name = name; | 131 if (receiver->IsGlobalObject()) cache_name = name; |
123 JSObject* last = receiver; | 132 Handle<JSObject> last = receiver; |
124 while (last->GetPrototype() != heap()->null_value()) { | 133 while (last->GetPrototype() != heap()->null_value()) { |
125 last = JSObject::cast(last->GetPrototype()); | 134 last = Handle<JSObject>(JSObject::cast(last->GetPrototype())); |
126 if (last->IsGlobalObject()) cache_name = name; | 135 if (last->IsGlobalObject()) cache_name = name; |
127 } | 136 } |
128 // Compile the stub that is either shared for all names or | 137 // Compile the stub that is either shared for all names or |
129 // name specific if there are global objects involved. | 138 // name specific if there are global objects involved. |
130 Code::Flags flags = | 139 Code::Flags flags = |
131 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); | 140 Code::ComputeMonomorphicFlags(Code::LOAD_IC, NONEXISTENT); |
132 Object* code = receiver->map()->FindInCodeCache(cache_name, flags); | 141 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags)); |
133 if (code->IsUndefined()) { | 142 if (probe->IsCode()) return Handle<Code>::cast(probe); |
134 LoadStubCompiler compiler; | 143 |
135 { MaybeObject* maybe_code = | 144 LoadStubCompiler compiler(isolate_); |
136 compiler.CompileLoadNonexistent(cache_name, receiver, last); | 145 Handle<Code> code = |
137 if (!maybe_code->ToObject(&code)) return maybe_code; | 146 compiler.CompileLoadNonexistent(cache_name, receiver, last); |
138 } | 147 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name)); |
139 PROFILE(isolate_, | 148 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code)); |
140 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), cache_name)); | 149 JSObject::UpdateMapCodeCache(isolate_, receiver, cache_name, code); |
141 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, cache_name, Code::cast(code))); | |
142 Object* result; | |
143 { MaybeObject* maybe_result = | |
144 receiver->UpdateMapCodeCache(cache_name, Code::cast(code)); | |
145 if (!maybe_result->ToObject(&result)) return maybe_result; | |
146 } | |
147 } | |
148 return code; | 150 return code; |
149 } | 151 } |
150 | 152 |
151 | 153 |
152 MaybeObject* StubCache::ComputeLoadField(String* name, | 154 Handle<Code> LoadStubCompiler::CompileLoadField(Handle<JSObject> object, |
153 JSObject* receiver, | 155 Handle<JSObject> holder, |
154 JSObject* holder, | 156 int index, |
| 157 Handle<String> name) { |
| 158 CALL_HEAP_FUNCTION(isolate(), |
| 159 CompileLoadField(*object, *holder, index, *name), |
| 160 Code); |
| 161 } |
| 162 |
| 163 |
| 164 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, |
| 165 Handle<JSObject> receiver, |
| 166 Handle<JSObject> holder, |
155 int field_index) { | 167 int field_index) { |
156 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 168 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
157 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); | 169 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, FIELD); |
158 Object* code = receiver->map()->FindInCodeCache(name, flags); | 170 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
159 if (code->IsUndefined()) { | 171 if (probe->IsCode()) return Handle<Code>::cast(probe); |
160 LoadStubCompiler compiler; | 172 |
161 { MaybeObject* maybe_code = | 173 LoadStubCompiler compiler(isolate_); |
162 compiler.CompileLoadField(receiver, holder, field_index, name); | 174 Handle<Code> code = |
163 if (!maybe_code->ToObject(&code)) return maybe_code; | 175 compiler.CompileLoadField(receiver, holder, field_index, name); |
164 } | 176 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
165 PROFILE(isolate_, | 177 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
166 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 178 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
167 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); | |
168 Object* result; | |
169 { MaybeObject* maybe_result = | |
170 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
171 if (!maybe_result->ToObject(&result)) return maybe_result; | |
172 } | |
173 } | |
174 return code; | 179 return code; |
175 } | 180 } |
176 | 181 |
177 | 182 |
178 MaybeObject* StubCache::ComputeLoadCallback(String* name, | 183 Handle<Code> LoadStubCompiler::CompileLoadCallback( |
179 JSObject* receiver, | 184 Handle<String> name, |
180 JSObject* holder, | 185 Handle<JSObject> object, |
181 AccessorInfo* callback) { | 186 Handle<JSObject> holder, |
| 187 Handle<AccessorInfo> callback) { |
| 188 CALL_HEAP_FUNCTION(isolate(), |
| 189 CompileLoadCallback(*name, *object, *holder, *callback), |
| 190 Code); |
| 191 } |
| 192 |
| 193 |
| 194 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, |
| 195 Handle<JSObject> receiver, |
| 196 Handle<JSObject> holder, |
| 197 Handle<AccessorInfo> callback) { |
182 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 198 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
183 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 199 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
184 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); | 200 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, CALLBACKS); |
185 Object* code = receiver->map()->FindInCodeCache(name, flags); | 201 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
186 if (code->IsUndefined()) { | 202 if (probe->IsCode()) return Handle<Code>::cast(probe); |
187 LoadStubCompiler compiler; | 203 |
188 { MaybeObject* maybe_code = | 204 LoadStubCompiler compiler(isolate_); |
189 compiler.CompileLoadCallback(name, receiver, holder, callback); | 205 Handle<Code> code = |
190 if (!maybe_code->ToObject(&code)) return maybe_code; | 206 compiler.CompileLoadCallback(name, receiver, holder, callback); |
191 } | 207 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
192 PROFILE(isolate_, | 208 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
193 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 209 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
194 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); | |
195 Object* result; | |
196 { MaybeObject* maybe_result = | |
197 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
198 if (!maybe_result->ToObject(&result)) return maybe_result; | |
199 } | |
200 } | |
201 return code; | 210 return code; |
202 } | 211 } |
203 | 212 |
204 | 213 |
205 MaybeObject* StubCache::ComputeLoadConstant(String* name, | 214 Handle<Code> LoadStubCompiler::CompileLoadConstant(Handle<JSObject> object, |
206 JSObject* receiver, | 215 Handle<JSObject> holder, |
207 JSObject* holder, | 216 Handle<Object> value, |
208 Object* value) { | 217 Handle<String> name) { |
209 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 218 CALL_HEAP_FUNCTION(isolate(), |
| 219 CompileLoadConstant(*object, *holder, *value, *name), |
| 220 Code); |
| 221 } |
| 222 |
| 223 |
| 224 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, |
| 225 Handle<JSObject> receiver, |
| 226 Handle<JSObject> holder, |
| 227 Handle<Object> value) { |
| 228 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
210 Code::Flags flags = | 229 Code::Flags flags = |
211 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); | 230 Code::ComputeMonomorphicFlags(Code::LOAD_IC, CONSTANT_FUNCTION); |
212 Object* code = receiver->map()->FindInCodeCache(name, flags); | 231 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
213 if (code->IsUndefined()) { | 232 if (probe->IsCode()) return Handle<Code>::cast(probe); |
214 LoadStubCompiler compiler; | 233 |
215 { MaybeObject* maybe_code = | 234 LoadStubCompiler compiler(isolate_); |
216 compiler.CompileLoadConstant(receiver, holder, value, name); | 235 Handle<Code> code = |
217 if (!maybe_code->ToObject(&code)) return maybe_code; | 236 compiler.CompileLoadConstant(receiver, holder, value, name); |
218 } | 237 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
219 PROFILE(isolate_, | 238 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
220 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 239 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
221 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); | |
222 Object* result; | |
223 { MaybeObject* maybe_result = | |
224 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
225 if (!maybe_result->ToObject(&result)) return maybe_result; | |
226 } | |
227 } | |
228 return code; | 240 return code; |
229 } | 241 } |
230 | 242 |
231 | 243 |
232 MaybeObject* StubCache::ComputeLoadInterceptor(String* name, | 244 Handle<Code> LoadStubCompiler::CompileLoadInterceptor(Handle<JSObject> object, |
233 JSObject* receiver, | 245 Handle<JSObject> holder, |
234 JSObject* holder) { | 246 Handle<String> name) { |
235 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 247 CALL_HEAP_FUNCTION(isolate(), |
| 248 CompileLoadInterceptor(*object, *holder, *name), |
| 249 Code); |
| 250 } |
| 251 |
| 252 |
| 253 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, |
| 254 Handle<JSObject> receiver, |
| 255 Handle<JSObject> holder) { |
| 256 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
236 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); | 257 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, INTERCEPTOR); |
237 Object* code = receiver->map()->FindInCodeCache(name, flags); | 258 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
238 if (code->IsUndefined()) { | 259 if (probe->IsCode()) return Handle<Code>::cast(probe); |
239 LoadStubCompiler compiler; | 260 |
240 { MaybeObject* maybe_code = | 261 LoadStubCompiler compiler(isolate_); |
241 compiler.CompileLoadInterceptor(receiver, holder, name); | 262 Handle<Code> code = |
242 if (!maybe_code->ToObject(&code)) return maybe_code; | 263 compiler.CompileLoadInterceptor(receiver, holder, name); |
243 } | 264 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
244 PROFILE(isolate_, | 265 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
245 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | 266 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
246 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); | |
247 Object* result; | |
248 { MaybeObject* maybe_result = | |
249 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
250 if (!maybe_result->ToObject(&result)) return maybe_result; | |
251 } | |
252 } | |
253 return code; | 267 return code; |
254 } | 268 } |
255 | 269 |
256 | 270 |
257 MaybeObject* StubCache::ComputeLoadNormal() { | 271 Handle<Code> StubCache::ComputeLoadNormal() { |
258 return isolate_->builtins()->builtin(Builtins::kLoadIC_Normal); | 272 return isolate_->builtins()->LoadIC_Normal(); |
259 } | 273 } |
260 | 274 |
| 275 Handle<Code> LoadStubCompiler::CompileLoadGlobal( |
| 276 Handle<JSObject> object, |
| 277 Handle<GlobalObject> holder, |
| 278 Handle<JSGlobalPropertyCell> cell, |
| 279 Handle<String> name, |
| 280 bool is_dont_delete) { |
| 281 CALL_HEAP_FUNCTION(isolate(), |
| 282 CompileLoadGlobal(*object, |
| 283 *holder, |
| 284 *cell, |
| 285 *name, |
| 286 is_dont_delete), |
| 287 Code); |
| 288 } |
| 289 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, |
| 290 Handle<JSObject> receiver, |
| 291 Handle<GlobalObject> holder, |
| 292 Handle<JSGlobalPropertyCell> cell, |
| 293 bool is_dont_delete) { |
| 294 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
| 295 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); |
| 296 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
| 297 if (probe->IsCode()) return Handle<Code>::cast(probe); |
261 | 298 |
262 MaybeObject* StubCache::ComputeLoadGlobal(String* name, | 299 LoadStubCompiler compiler(isolate_); |
263 JSObject* receiver, | 300 Handle<Code> code = |
264 GlobalObject* holder, | 301 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); |
265 JSGlobalPropertyCell* cell, | 302 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
266 bool is_dont_delete) { | 303 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
267 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 304 JSObject::UpdateMapCodeCache(isolate_, receiver, name, code); |
268 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | |
269 Object* code = receiver->map()->FindInCodeCache(name, flags); | |
270 if (code->IsUndefined()) { | |
271 LoadStubCompiler compiler; | |
272 { MaybeObject* maybe_code = compiler.CompileLoadGlobal(receiver, | |
273 holder, | |
274 cell, | |
275 name, | |
276 is_dont_delete); | |
277 if (!maybe_code->ToObject(&code)) return maybe_code; | |
278 } | |
279 PROFILE(isolate_, | |
280 CodeCreateEvent(Logger::LOAD_IC_TAG, Code::cast(code), name)); | |
281 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, name, Code::cast(code))); | |
282 Object* result; | |
283 { MaybeObject* maybe_result = | |
284 receiver->UpdateMapCodeCache(name, Code::cast(code)); | |
285 if (!maybe_result->ToObject(&result)) return maybe_result; | |
286 } | |
287 } | |
288 return code; | 305 return code; |
289 } | 306 } |
290 | 307 |
291 | 308 |
292 MaybeObject* StubCache::ComputeKeyedLoadField(String* name, | 309 MaybeObject* StubCache::ComputeKeyedLoadField(String* name, |
293 JSObject* receiver, | 310 JSObject* receiver, |
294 JSObject* holder, | 311 JSObject* holder, |
295 int field_index) { | 312 int field_index) { |
296 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 313 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
297 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); | 314 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, FIELD); |
298 Object* code = receiver->map()->FindInCodeCache(name, flags); | 315 Object* code = receiver->map()->FindInCodeCache(name, flags); |
299 if (code->IsUndefined()) { | 316 if (code->IsUndefined()) { |
300 KeyedLoadStubCompiler compiler; | 317 HandleScope scope(isolate_); |
| 318 KeyedLoadStubCompiler compiler(isolate_); |
301 { MaybeObject* maybe_code = | 319 { MaybeObject* maybe_code = |
302 compiler.CompileLoadField(name, receiver, holder, field_index); | 320 compiler.CompileLoadField(name, receiver, holder, field_index); |
303 if (!maybe_code->ToObject(&code)) return maybe_code; | 321 if (!maybe_code->ToObject(&code)) return maybe_code; |
304 } | 322 } |
305 PROFILE(isolate_, | 323 PROFILE(isolate_, |
306 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 324 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
307 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 325 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
308 Object* result; | 326 Object* result; |
309 { MaybeObject* maybe_result = | 327 { MaybeObject* maybe_result = |
310 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 328 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
311 if (!maybe_result->ToObject(&result)) return maybe_result; | 329 if (!maybe_result->ToObject(&result)) return maybe_result; |
312 } | 330 } |
313 } | 331 } |
314 return code; | 332 return code; |
315 } | 333 } |
316 | 334 |
317 | 335 |
318 MaybeObject* StubCache::ComputeKeyedLoadConstant(String* name, | 336 MaybeObject* StubCache::ComputeKeyedLoadConstant(String* name, |
319 JSObject* receiver, | 337 JSObject* receiver, |
320 JSObject* holder, | 338 JSObject* holder, |
321 Object* value) { | 339 Object* value) { |
322 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 340 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
323 Code::Flags flags = | 341 Code::Flags flags = |
324 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); | 342 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CONSTANT_FUNCTION); |
325 Object* code = receiver->map()->FindInCodeCache(name, flags); | 343 Object* code = receiver->map()->FindInCodeCache(name, flags); |
326 if (code->IsUndefined()) { | 344 if (code->IsUndefined()) { |
327 KeyedLoadStubCompiler compiler; | 345 HandleScope scope(isolate_); |
| 346 KeyedLoadStubCompiler compiler(isolate_); |
328 { MaybeObject* maybe_code = | 347 { MaybeObject* maybe_code = |
329 compiler.CompileLoadConstant(name, receiver, holder, value); | 348 compiler.CompileLoadConstant(name, receiver, holder, value); |
330 if (!maybe_code->ToObject(&code)) return maybe_code; | 349 if (!maybe_code->ToObject(&code)) return maybe_code; |
331 } | 350 } |
332 PROFILE(isolate_, | 351 PROFILE(isolate_, |
333 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 352 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
334 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 353 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
335 Object* result; | 354 Object* result; |
336 { MaybeObject* maybe_result = | 355 { MaybeObject* maybe_result = |
337 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 356 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
338 if (!maybe_result->ToObject(&result)) return maybe_result; | 357 if (!maybe_result->ToObject(&result)) return maybe_result; |
339 } | 358 } |
340 } | 359 } |
341 return code; | 360 return code; |
342 } | 361 } |
343 | 362 |
344 | 363 |
345 MaybeObject* StubCache::ComputeKeyedLoadInterceptor(String* name, | 364 MaybeObject* StubCache::ComputeKeyedLoadInterceptor(String* name, |
346 JSObject* receiver, | 365 JSObject* receiver, |
347 JSObject* holder) { | 366 JSObject* holder) { |
348 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 367 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
349 Code::Flags flags = | 368 Code::Flags flags = |
350 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); | 369 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, INTERCEPTOR); |
351 Object* code = receiver->map()->FindInCodeCache(name, flags); | 370 Object* code = receiver->map()->FindInCodeCache(name, flags); |
352 if (code->IsUndefined()) { | 371 if (code->IsUndefined()) { |
353 KeyedLoadStubCompiler compiler; | 372 HandleScope scope(isolate_); |
| 373 KeyedLoadStubCompiler compiler(isolate_); |
354 { MaybeObject* maybe_code = | 374 { MaybeObject* maybe_code = |
355 compiler.CompileLoadInterceptor(receiver, holder, name); | 375 compiler.CompileLoadInterceptor(receiver, holder, name); |
356 if (!maybe_code->ToObject(&code)) return maybe_code; | 376 if (!maybe_code->ToObject(&code)) return maybe_code; |
357 } | 377 } |
358 PROFILE(isolate_, | 378 PROFILE(isolate_, |
359 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 379 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
360 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 380 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
361 Object* result; | 381 Object* result; |
362 { MaybeObject* maybe_result = | 382 { MaybeObject* maybe_result = |
363 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 383 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
364 if (!maybe_result->ToObject(&result)) return maybe_result; | 384 if (!maybe_result->ToObject(&result)) return maybe_result; |
365 } | 385 } |
366 } | 386 } |
367 return code; | 387 return code; |
368 } | 388 } |
369 | 389 |
370 | 390 |
371 MaybeObject* StubCache::ComputeKeyedLoadCallback(String* name, | 391 MaybeObject* StubCache::ComputeKeyedLoadCallback(String* name, |
372 JSObject* receiver, | 392 JSObject* receiver, |
373 JSObject* holder, | 393 JSObject* holder, |
374 AccessorInfo* callback) { | 394 AccessorInfo* callback) { |
375 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); | 395 ASSERT(IC::GetCodeCacheForObject(receiver, holder) == OWN_MAP); |
376 Code::Flags flags = | 396 Code::Flags flags = |
377 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 397 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
378 Object* code = receiver->map()->FindInCodeCache(name, flags); | 398 Object* code = receiver->map()->FindInCodeCache(name, flags); |
379 if (code->IsUndefined()) { | 399 if (code->IsUndefined()) { |
380 KeyedLoadStubCompiler compiler; | 400 HandleScope scope(isolate_); |
| 401 KeyedLoadStubCompiler compiler(isolate_); |
381 { MaybeObject* maybe_code = | 402 { MaybeObject* maybe_code = |
382 compiler.CompileLoadCallback(name, receiver, holder, callback); | 403 compiler.CompileLoadCallback(name, receiver, holder, callback); |
383 if (!maybe_code->ToObject(&code)) return maybe_code; | 404 if (!maybe_code->ToObject(&code)) return maybe_code; |
384 } | 405 } |
385 PROFILE(isolate_, | 406 PROFILE(isolate_, |
386 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 407 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
387 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 408 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
388 Object* result; | 409 Object* result; |
389 { MaybeObject* maybe_result = | 410 { MaybeObject* maybe_result = |
390 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 411 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
391 if (!maybe_result->ToObject(&result)) return maybe_result; | 412 if (!maybe_result->ToObject(&result)) return maybe_result; |
392 } | 413 } |
393 } | 414 } |
394 return code; | 415 return code; |
395 } | 416 } |
396 | 417 |
397 | 418 |
398 | 419 |
399 MaybeObject* StubCache::ComputeKeyedLoadArrayLength(String* name, | 420 MaybeObject* StubCache::ComputeKeyedLoadArrayLength(String* name, |
400 JSArray* receiver) { | 421 JSArray* receiver) { |
401 Code::Flags flags = | 422 Code::Flags flags = |
402 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 423 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
403 ASSERT(receiver->IsJSObject()); | 424 ASSERT(receiver->IsJSObject()); |
404 Object* code = receiver->map()->FindInCodeCache(name, flags); | 425 Object* code = receiver->map()->FindInCodeCache(name, flags); |
405 if (code->IsUndefined()) { | 426 if (code->IsUndefined()) { |
406 KeyedLoadStubCompiler compiler; | 427 HandleScope scope(isolate_); |
| 428 KeyedLoadStubCompiler compiler(isolate_); |
407 { MaybeObject* maybe_code = compiler.CompileLoadArrayLength(name); | 429 { MaybeObject* maybe_code = compiler.CompileLoadArrayLength(name); |
408 if (!maybe_code->ToObject(&code)) return maybe_code; | 430 if (!maybe_code->ToObject(&code)) return maybe_code; |
409 } | 431 } |
410 PROFILE(isolate_, | 432 PROFILE(isolate_, |
411 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 433 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
412 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 434 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
413 Object* result; | 435 Object* result; |
414 { MaybeObject* maybe_result = | 436 { MaybeObject* maybe_result = |
415 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 437 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
416 if (!maybe_result->ToObject(&result)) return maybe_result; | 438 if (!maybe_result->ToObject(&result)) return maybe_result; |
417 } | 439 } |
418 } | 440 } |
419 return code; | 441 return code; |
420 } | 442 } |
421 | 443 |
422 | 444 |
423 MaybeObject* StubCache::ComputeKeyedLoadStringLength(String* name, | 445 MaybeObject* StubCache::ComputeKeyedLoadStringLength(String* name, |
424 String* receiver) { | 446 String* receiver) { |
425 Code::Flags flags = | 447 Code::Flags flags = |
426 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 448 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
427 Map* map = receiver->map(); | 449 Map* map = receiver->map(); |
428 Object* code = map->FindInCodeCache(name, flags); | 450 Object* code = map->FindInCodeCache(name, flags); |
429 if (code->IsUndefined()) { | 451 if (code->IsUndefined()) { |
430 KeyedLoadStubCompiler compiler; | 452 HandleScope scope(isolate_); |
| 453 KeyedLoadStubCompiler compiler(isolate_); |
431 { MaybeObject* maybe_code = compiler.CompileLoadStringLength(name); | 454 { MaybeObject* maybe_code = compiler.CompileLoadStringLength(name); |
432 if (!maybe_code->ToObject(&code)) return maybe_code; | 455 if (!maybe_code->ToObject(&code)) return maybe_code; |
433 } | 456 } |
434 PROFILE(isolate_, | 457 PROFILE(isolate_, |
435 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 458 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
436 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 459 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
437 Object* result; | 460 Object* result; |
438 { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code)); | 461 { MaybeObject* maybe_result = map->UpdateCodeCache(name, Code::cast(code)); |
439 if (!maybe_result->ToObject(&result)) return maybe_result; | 462 if (!maybe_result->ToObject(&result)) return maybe_result; |
440 } | 463 } |
441 } | 464 } |
442 return code; | 465 return code; |
443 } | 466 } |
444 | 467 |
445 | 468 |
446 MaybeObject* StubCache::ComputeKeyedLoadFunctionPrototype( | 469 MaybeObject* StubCache::ComputeKeyedLoadFunctionPrototype( |
447 String* name, | 470 String* name, |
448 JSFunction* receiver) { | 471 JSFunction* receiver) { |
449 Code::Flags flags = | 472 Code::Flags flags = |
450 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); | 473 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, CALLBACKS); |
451 Object* code = receiver->map()->FindInCodeCache(name, flags); | 474 Object* code = receiver->map()->FindInCodeCache(name, flags); |
452 if (code->IsUndefined()) { | 475 if (code->IsUndefined()) { |
453 KeyedLoadStubCompiler compiler; | 476 HandleScope scope(isolate_); |
| 477 KeyedLoadStubCompiler compiler(isolate_); |
454 { MaybeObject* maybe_code = compiler.CompileLoadFunctionPrototype(name); | 478 { MaybeObject* maybe_code = compiler.CompileLoadFunctionPrototype(name); |
455 if (!maybe_code->ToObject(&code)) return maybe_code; | 479 if (!maybe_code->ToObject(&code)) return maybe_code; |
456 } | 480 } |
457 PROFILE(isolate_, | 481 PROFILE(isolate_, |
458 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); | 482 CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, Code::cast(code), name)); |
459 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); | 483 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, name, Code::cast(code))); |
460 Object* result; | 484 Object* result; |
461 { MaybeObject* maybe_result = | 485 { MaybeObject* maybe_result = |
462 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 486 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
463 if (!maybe_result->ToObject(&result)) return maybe_result; | 487 if (!maybe_result->ToObject(&result)) return maybe_result; |
464 } | 488 } |
465 } | 489 } |
466 return code; | 490 return code; |
467 } | 491 } |
468 | 492 |
469 | 493 |
470 MaybeObject* StubCache::ComputeStoreField(String* name, | 494 MaybeObject* StubCache::ComputeStoreField(String* name, |
471 JSObject* receiver, | 495 JSObject* receiver, |
472 int field_index, | 496 int field_index, |
473 Map* transition, | 497 Map* transition, |
474 StrictModeFlag strict_mode) { | 498 StrictModeFlag strict_mode) { |
475 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 499 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
476 Code::Flags flags = Code::ComputeMonomorphicFlags( | 500 Code::Flags flags = Code::ComputeMonomorphicFlags( |
477 Code::STORE_IC, type, strict_mode); | 501 Code::STORE_IC, type, strict_mode); |
478 Object* code = receiver->map()->FindInCodeCache(name, flags); | 502 Object* code = receiver->map()->FindInCodeCache(name, flags); |
479 if (code->IsUndefined()) { | 503 if (code->IsUndefined()) { |
480 StoreStubCompiler compiler(strict_mode); | 504 HandleScope scope(isolate_); |
| 505 StoreStubCompiler compiler(isolate_, strict_mode); |
481 { MaybeObject* maybe_code = | 506 { MaybeObject* maybe_code = |
482 compiler.CompileStoreField(receiver, field_index, transition, name); | 507 compiler.CompileStoreField(receiver, field_index, transition, name); |
483 if (!maybe_code->ToObject(&code)) return maybe_code; | 508 if (!maybe_code->ToObject(&code)) return maybe_code; |
484 } | 509 } |
485 PROFILE(isolate_, | 510 PROFILE(isolate_, |
486 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 511 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
487 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 512 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
488 Object* result; | 513 Object* result; |
489 { MaybeObject* maybe_result = | 514 { MaybeObject* maybe_result = |
490 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 515 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
(...skipping 26 matching lines...) Expand all Loading... |
517 UNREACHABLE(); | 542 UNREACHABLE(); |
518 break; | 543 break; |
519 } | 544 } |
520 Object* maybe_code = receiver->map()->FindInCodeCache(name, flags); | 545 Object* maybe_code = receiver->map()->FindInCodeCache(name, flags); |
521 if (!maybe_code->IsUndefined()) return Code::cast(maybe_code); | 546 if (!maybe_code->IsUndefined()) return Code::cast(maybe_code); |
522 | 547 |
523 Map* receiver_map = receiver->map(); | 548 Map* receiver_map = receiver->map(); |
524 MaybeObject* maybe_new_code = NULL; | 549 MaybeObject* maybe_new_code = NULL; |
525 switch (stub_kind) { | 550 switch (stub_kind) { |
526 case KeyedIC::LOAD: { | 551 case KeyedIC::LOAD: { |
527 KeyedLoadStubCompiler compiler; | 552 HandleScope scope(isolate_); |
| 553 KeyedLoadStubCompiler compiler(isolate_); |
528 maybe_new_code = compiler.CompileLoadElement(receiver_map); | 554 maybe_new_code = compiler.CompileLoadElement(receiver_map); |
529 break; | 555 break; |
530 } | 556 } |
531 case KeyedIC::STORE_NO_TRANSITION: { | 557 case KeyedIC::STORE_NO_TRANSITION: { |
532 KeyedStoreStubCompiler compiler(strict_mode); | 558 HandleScope scope(isolate_); |
| 559 KeyedStoreStubCompiler compiler(isolate_, strict_mode); |
533 maybe_new_code = compiler.CompileStoreElement(receiver_map); | 560 maybe_new_code = compiler.CompileStoreElement(receiver_map); |
534 break; | 561 break; |
535 } | 562 } |
536 default: | 563 default: |
537 UNREACHABLE(); | 564 UNREACHABLE(); |
538 break; | 565 break; |
539 } | 566 } |
540 Code* code = NULL; | 567 Code* code = NULL; |
541 if (!maybe_new_code->To(&code)) return maybe_new_code; | 568 if (!maybe_new_code->To(&code)) return maybe_new_code; |
542 | 569 |
(...skipping 24 matching lines...) Expand all Loading... |
567 | 594 |
568 | 595 |
569 MaybeObject* StubCache::ComputeStoreGlobal(String* name, | 596 MaybeObject* StubCache::ComputeStoreGlobal(String* name, |
570 GlobalObject* receiver, | 597 GlobalObject* receiver, |
571 JSGlobalPropertyCell* cell, | 598 JSGlobalPropertyCell* cell, |
572 StrictModeFlag strict_mode) { | 599 StrictModeFlag strict_mode) { |
573 Code::Flags flags = Code::ComputeMonomorphicFlags( | 600 Code::Flags flags = Code::ComputeMonomorphicFlags( |
574 Code::STORE_IC, NORMAL, strict_mode); | 601 Code::STORE_IC, NORMAL, strict_mode); |
575 Object* code = receiver->map()->FindInCodeCache(name, flags); | 602 Object* code = receiver->map()->FindInCodeCache(name, flags); |
576 if (code->IsUndefined()) { | 603 if (code->IsUndefined()) { |
577 StoreStubCompiler compiler(strict_mode); | 604 HandleScope scope(isolate_); |
| 605 StoreStubCompiler compiler(isolate_, strict_mode); |
578 { MaybeObject* maybe_code = | 606 { MaybeObject* maybe_code = |
579 compiler.CompileStoreGlobal(receiver, cell, name); | 607 compiler.CompileStoreGlobal(receiver, cell, name); |
580 if (!maybe_code->ToObject(&code)) return maybe_code; | 608 if (!maybe_code->ToObject(&code)) return maybe_code; |
581 } | 609 } |
582 PROFILE(isolate_, | 610 PROFILE(isolate_, |
583 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 611 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
584 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 612 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
585 Object* result; | 613 Object* result; |
586 { MaybeObject* maybe_result = | 614 { MaybeObject* maybe_result = |
587 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 615 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
588 if (!maybe_result->ToObject(&result)) return maybe_result; | 616 if (!maybe_result->ToObject(&result)) return maybe_result; |
589 } | 617 } |
590 } | 618 } |
591 return code; | 619 return code; |
592 } | 620 } |
593 | 621 |
594 | 622 |
595 MaybeObject* StubCache::ComputeStoreCallback( | 623 MaybeObject* StubCache::ComputeStoreCallback( |
596 String* name, | 624 String* name, |
597 JSObject* receiver, | 625 JSObject* receiver, |
598 AccessorInfo* callback, | 626 AccessorInfo* callback, |
599 StrictModeFlag strict_mode) { | 627 StrictModeFlag strict_mode) { |
600 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 628 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
601 Code::Flags flags = Code::ComputeMonomorphicFlags( | 629 Code::Flags flags = Code::ComputeMonomorphicFlags( |
602 Code::STORE_IC, CALLBACKS, strict_mode); | 630 Code::STORE_IC, CALLBACKS, strict_mode); |
603 Object* code = receiver->map()->FindInCodeCache(name, flags); | 631 Object* code = receiver->map()->FindInCodeCache(name, flags); |
604 if (code->IsUndefined()) { | 632 if (code->IsUndefined()) { |
605 StoreStubCompiler compiler(strict_mode); | 633 HandleScope scope(isolate_); |
| 634 StoreStubCompiler compiler(isolate_, strict_mode); |
606 { MaybeObject* maybe_code = | 635 { MaybeObject* maybe_code = |
607 compiler.CompileStoreCallback(receiver, callback, name); | 636 compiler.CompileStoreCallback(receiver, callback, name); |
608 if (!maybe_code->ToObject(&code)) return maybe_code; | 637 if (!maybe_code->ToObject(&code)) return maybe_code; |
609 } | 638 } |
610 PROFILE(isolate_, | 639 PROFILE(isolate_, |
611 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 640 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
612 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 641 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
613 Object* result; | 642 Object* result; |
614 { MaybeObject* maybe_result = | 643 { MaybeObject* maybe_result = |
615 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 644 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
616 if (!maybe_result->ToObject(&result)) return maybe_result; | 645 if (!maybe_result->ToObject(&result)) return maybe_result; |
617 } | 646 } |
618 } | 647 } |
619 return code; | 648 return code; |
620 } | 649 } |
621 | 650 |
622 | 651 |
623 MaybeObject* StubCache::ComputeStoreInterceptor( | 652 MaybeObject* StubCache::ComputeStoreInterceptor( |
624 String* name, | 653 String* name, |
625 JSObject* receiver, | 654 JSObject* receiver, |
626 StrictModeFlag strict_mode) { | 655 StrictModeFlag strict_mode) { |
627 Code::Flags flags = Code::ComputeMonomorphicFlags( | 656 Code::Flags flags = Code::ComputeMonomorphicFlags( |
628 Code::STORE_IC, INTERCEPTOR, strict_mode); | 657 Code::STORE_IC, INTERCEPTOR, strict_mode); |
629 Object* code = receiver->map()->FindInCodeCache(name, flags); | 658 Object* code = receiver->map()->FindInCodeCache(name, flags); |
630 if (code->IsUndefined()) { | 659 if (code->IsUndefined()) { |
631 StoreStubCompiler compiler(strict_mode); | 660 HandleScope scope(isolate_); |
| 661 StoreStubCompiler compiler(isolate_, strict_mode); |
632 { MaybeObject* maybe_code = | 662 { MaybeObject* maybe_code = |
633 compiler.CompileStoreInterceptor(receiver, name); | 663 compiler.CompileStoreInterceptor(receiver, name); |
634 if (!maybe_code->ToObject(&code)) return maybe_code; | 664 if (!maybe_code->ToObject(&code)) return maybe_code; |
635 } | 665 } |
636 PROFILE(isolate_, | 666 PROFILE(isolate_, |
637 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); | 667 CodeCreateEvent(Logger::STORE_IC_TAG, Code::cast(code), name)); |
638 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); | 668 GDBJIT(AddCode(GDBJITInterface::STORE_IC, name, Code::cast(code))); |
639 Object* result; | 669 Object* result; |
640 { MaybeObject* maybe_result = | 670 { MaybeObject* maybe_result = |
641 receiver->UpdateMapCodeCache(name, Code::cast(code)); | 671 receiver->UpdateMapCodeCache(name, Code::cast(code)); |
642 if (!maybe_result->ToObject(&result)) return maybe_result; | 672 if (!maybe_result->ToObject(&result)) return maybe_result; |
643 } | 673 } |
644 } | 674 } |
645 return code; | 675 return code; |
646 } | 676 } |
647 | 677 |
648 | 678 |
649 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, | 679 MaybeObject* StubCache::ComputeKeyedStoreField(String* name, |
650 JSObject* receiver, | 680 JSObject* receiver, |
651 int field_index, | 681 int field_index, |
652 Map* transition, | 682 Map* transition, |
653 StrictModeFlag strict_mode) { | 683 StrictModeFlag strict_mode) { |
654 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; | 684 PropertyType type = (transition == NULL) ? FIELD : MAP_TRANSITION; |
655 Code::Flags flags = Code::ComputeMonomorphicFlags( | 685 Code::Flags flags = Code::ComputeMonomorphicFlags( |
656 Code::KEYED_STORE_IC, type, strict_mode); | 686 Code::KEYED_STORE_IC, type, strict_mode); |
657 Object* code = receiver->map()->FindInCodeCache(name, flags); | 687 Object* code = receiver->map()->FindInCodeCache(name, flags); |
658 if (code->IsUndefined()) { | 688 if (code->IsUndefined()) { |
659 KeyedStoreStubCompiler compiler(strict_mode); | 689 HandleScope scope(isolate()); |
| 690 KeyedStoreStubCompiler compiler(isolate(), strict_mode); |
660 { MaybeObject* maybe_code = | 691 { MaybeObject* maybe_code = |
661 compiler.CompileStoreField(receiver, field_index, transition, name); | 692 compiler.CompileStoreField(receiver, field_index, transition, name); |
662 if (!maybe_code->ToObject(&code)) return maybe_code; | 693 if (!maybe_code->ToObject(&code)) return maybe_code; |
663 } | 694 } |
664 PROFILE(isolate(), | 695 PROFILE(isolate(), |
665 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, | 696 CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, |
666 Code::cast(code), name)); | 697 Code::cast(code), name)); |
667 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); | 698 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code))); |
668 Object* result; | 699 Object* result; |
669 { MaybeObject* maybe_result = | 700 { MaybeObject* maybe_result = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 cache_holder, | 736 cache_holder, |
706 argc); | 737 argc); |
707 Object* code = map_holder->map()->FindInCodeCache(name, flags); | 738 Object* code = map_holder->map()->FindInCodeCache(name, flags); |
708 if (code->IsUndefined()) { | 739 if (code->IsUndefined()) { |
709 // If the function hasn't been compiled yet, we cannot do it now | 740 // If the function hasn't been compiled yet, we cannot do it now |
710 // because it may cause GC. To avoid this issue, we return an | 741 // because it may cause GC. To avoid this issue, we return an |
711 // internal error which will make sure we do not update any | 742 // internal error which will make sure we do not update any |
712 // caches. | 743 // caches. |
713 if (!function->is_compiled()) return Failure::InternalError(); | 744 if (!function->is_compiled()) return Failure::InternalError(); |
714 // Compile the stub - only create stubs for fully compiled functions. | 745 // Compile the stub - only create stubs for fully compiled functions. |
715 CallStubCompiler compiler(argc, kind, extra_ic_state, cache_holder); | 746 HandleScope scope(isolate_); |
| 747 CallStubCompiler compiler(isolate_, |
| 748 argc, |
| 749 kind, |
| 750 extra_ic_state, |
| 751 cache_holder); |
716 { MaybeObject* maybe_code = | 752 { MaybeObject* maybe_code = |
717 compiler.CompileCallConstant(object, holder, function, name, check); | 753 compiler.CompileCallConstant(object, holder, function, name, check); |
718 if (!maybe_code->ToObject(&code)) return maybe_code; | 754 if (!maybe_code->ToObject(&code)) return maybe_code; |
719 } | 755 } |
720 Code::cast(code)->set_check_type(check); | 756 Code::cast(code)->set_check_type(check); |
721 ASSERT_EQ(flags, Code::cast(code)->flags()); | 757 ASSERT_EQ(flags, Code::cast(code)->flags()); |
722 PROFILE(isolate_, | 758 PROFILE(isolate_, |
723 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 759 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
724 Code::cast(code), name)); | 760 Code::cast(code), name)); |
725 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); | 761 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
(...skipping 26 matching lines...) Expand all Loading... |
752 object = holder; | 788 object = holder; |
753 } | 789 } |
754 | 790 |
755 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, | 791 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, |
756 FIELD, | 792 FIELD, |
757 extra_ic_state, | 793 extra_ic_state, |
758 cache_holder, | 794 cache_holder, |
759 argc); | 795 argc); |
760 Object* code = map_holder->map()->FindInCodeCache(name, flags); | 796 Object* code = map_holder->map()->FindInCodeCache(name, flags); |
761 if (code->IsUndefined()) { | 797 if (code->IsUndefined()) { |
762 CallStubCompiler compiler(argc, kind, extra_ic_state, cache_holder); | 798 HandleScope scope(isolate_); |
| 799 CallStubCompiler compiler(isolate_, |
| 800 argc, |
| 801 kind, |
| 802 extra_ic_state, |
| 803 cache_holder); |
763 { MaybeObject* maybe_code = | 804 { MaybeObject* maybe_code = |
764 compiler.CompileCallField(JSObject::cast(object), | 805 compiler.CompileCallField(JSObject::cast(object), |
765 holder, | 806 holder, |
766 index, | 807 index, |
767 name); | 808 name); |
768 if (!maybe_code->ToObject(&code)) return maybe_code; | 809 if (!maybe_code->ToObject(&code)) return maybe_code; |
769 } | 810 } |
770 ASSERT_EQ(flags, Code::cast(code)->flags()); | 811 ASSERT_EQ(flags, Code::cast(code)->flags()); |
771 PROFILE(isolate_, | 812 PROFILE(isolate_, |
772 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 813 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
(...skipping 28 matching lines...) Expand all Loading... |
801 object = holder; | 842 object = holder; |
802 } | 843 } |
803 | 844 |
804 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, | 845 Code::Flags flags = Code::ComputeMonomorphicFlags(kind, |
805 INTERCEPTOR, | 846 INTERCEPTOR, |
806 extra_ic_state, | 847 extra_ic_state, |
807 cache_holder, | 848 cache_holder, |
808 argc); | 849 argc); |
809 Object* code = map_holder->map()->FindInCodeCache(name, flags); | 850 Object* code = map_holder->map()->FindInCodeCache(name, flags); |
810 if (code->IsUndefined()) { | 851 if (code->IsUndefined()) { |
811 CallStubCompiler compiler(argc, kind, extra_ic_state, cache_holder); | 852 HandleScope scope(isolate()); |
| 853 CallStubCompiler compiler(isolate(), |
| 854 argc, |
| 855 kind, |
| 856 extra_ic_state, |
| 857 cache_holder); |
812 { MaybeObject* maybe_code = | 858 { MaybeObject* maybe_code = |
813 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name); | 859 compiler.CompileCallInterceptor(JSObject::cast(object), holder, name); |
814 if (!maybe_code->ToObject(&code)) return maybe_code; | 860 if (!maybe_code->ToObject(&code)) return maybe_code; |
815 } | 861 } |
816 ASSERT_EQ(flags, Code::cast(code)->flags()); | 862 ASSERT_EQ(flags, Code::cast(code)->flags()); |
817 PROFILE(isolate(), | 863 PROFILE(isolate(), |
818 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 864 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
819 Code::cast(code), name)); | 865 Code::cast(code), name)); |
820 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); | 866 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
821 Object* result; | 867 Object* result; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 extra_ic_state, | 903 extra_ic_state, |
858 cache_holder, | 904 cache_holder, |
859 argc); | 905 argc); |
860 Object* code = map_holder->map()->FindInCodeCache(name, flags); | 906 Object* code = map_holder->map()->FindInCodeCache(name, flags); |
861 if (code->IsUndefined()) { | 907 if (code->IsUndefined()) { |
862 // If the function hasn't been compiled yet, we cannot do it now | 908 // If the function hasn't been compiled yet, we cannot do it now |
863 // because it may cause GC. To avoid this issue, we return an | 909 // because it may cause GC. To avoid this issue, we return an |
864 // internal error which will make sure we do not update any | 910 // internal error which will make sure we do not update any |
865 // caches. | 911 // caches. |
866 if (!function->is_compiled()) return Failure::InternalError(); | 912 if (!function->is_compiled()) return Failure::InternalError(); |
867 CallStubCompiler compiler(argc, kind, extra_ic_state, cache_holder); | 913 HandleScope scope(isolate()); |
| 914 CallStubCompiler compiler(isolate(), |
| 915 argc, |
| 916 kind, |
| 917 extra_ic_state, |
| 918 cache_holder); |
868 { MaybeObject* maybe_code = | 919 { MaybeObject* maybe_code = |
869 compiler.CompileCallGlobal(receiver, holder, cell, function, name); | 920 compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
870 if (!maybe_code->ToObject(&code)) return maybe_code; | 921 if (!maybe_code->ToObject(&code)) return maybe_code; |
871 } | 922 } |
872 ASSERT_EQ(flags, Code::cast(code)->flags()); | 923 ASSERT_EQ(flags, Code::cast(code)->flags()); |
873 PROFILE(isolate(), | 924 PROFILE(isolate(), |
874 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), | 925 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), |
875 Code::cast(code), name)); | 926 Code::cast(code), name)); |
876 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); | 927 GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code))); |
877 Object* result; | 928 Object* result; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
960 Code::Flags flags = Code::ComputeFlags(kind, | 1011 Code::Flags flags = Code::ComputeFlags(kind, |
961 UNINITIALIZED, | 1012 UNINITIALIZED, |
962 extra_state, | 1013 extra_state, |
963 NORMAL, | 1014 NORMAL, |
964 argc); | 1015 argc); |
965 Object* probe; | 1016 Object* probe; |
966 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1017 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
967 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1018 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
968 } | 1019 } |
969 if (!probe->IsUndefined()) return probe; | 1020 if (!probe->IsUndefined()) return probe; |
970 StubCompiler compiler; | 1021 HandleScope scope(isolate_); |
| 1022 StubCompiler compiler(isolate_); |
971 return FillCache(isolate_, compiler.CompileCallInitialize(flags)); | 1023 return FillCache(isolate_, compiler.CompileCallInitialize(flags)); |
972 } | 1024 } |
973 | 1025 |
974 | 1026 |
975 Handle<Code> StubCache::ComputeCallInitialize(int argc, | 1027 Handle<Code> StubCache::ComputeCallInitialize(int argc, |
976 RelocInfo::Mode mode) { | 1028 RelocInfo::Mode mode) { |
977 CALL_HEAP_FUNCTION(isolate_, | 1029 CALL_HEAP_FUNCTION(isolate_, |
978 ComputeCallInitialize(argc, mode, Code::CALL_IC), | 1030 ComputeCallInitialize(argc, mode, Code::CALL_IC), |
979 Code); | 1031 Code); |
980 } | 1032 } |
(...skipping 14 matching lines...) Expand all Loading... |
995 Code::Flags flags = Code::ComputeFlags(kind, | 1047 Code::Flags flags = Code::ComputeFlags(kind, |
996 PREMONOMORPHIC, | 1048 PREMONOMORPHIC, |
997 extra_ic_state, | 1049 extra_ic_state, |
998 NORMAL, | 1050 NORMAL, |
999 argc); | 1051 argc); |
1000 Object* probe; | 1052 Object* probe; |
1001 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1053 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1002 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1054 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1003 } | 1055 } |
1004 if (!probe->IsUndefined()) return probe; | 1056 if (!probe->IsUndefined()) return probe; |
1005 StubCompiler compiler; | 1057 HandleScope scope(isolate_); |
| 1058 StubCompiler compiler(isolate_); |
1006 return FillCache(isolate_, compiler.CompileCallPreMonomorphic(flags)); | 1059 return FillCache(isolate_, compiler.CompileCallPreMonomorphic(flags)); |
1007 } | 1060 } |
1008 | 1061 |
1009 | 1062 |
1010 MaybeObject* StubCache::ComputeCallNormal(int argc, | 1063 MaybeObject* StubCache::ComputeCallNormal(int argc, |
1011 Code::Kind kind, | 1064 Code::Kind kind, |
1012 Code::ExtraICState extra_ic_state) { | 1065 Code::ExtraICState extra_ic_state) { |
1013 Code::Flags flags = Code::ComputeFlags(kind, | 1066 Code::Flags flags = Code::ComputeFlags(kind, |
1014 MONOMORPHIC, | 1067 MONOMORPHIC, |
1015 extra_ic_state, | 1068 extra_ic_state, |
1016 NORMAL, | 1069 NORMAL, |
1017 argc); | 1070 argc); |
1018 Object* probe; | 1071 Object* probe; |
1019 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1072 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1020 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1073 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1021 } | 1074 } |
1022 if (!probe->IsUndefined()) return probe; | 1075 if (!probe->IsUndefined()) return probe; |
1023 StubCompiler compiler; | 1076 HandleScope scope(isolate_); |
| 1077 StubCompiler compiler(isolate_); |
1024 return FillCache(isolate_, compiler.CompileCallNormal(flags)); | 1078 return FillCache(isolate_, compiler.CompileCallNormal(flags)); |
1025 } | 1079 } |
1026 | 1080 |
1027 | 1081 |
1028 MaybeObject* StubCache::ComputeCallArguments(int argc, Code::Kind kind) { | 1082 MaybeObject* StubCache::ComputeCallArguments(int argc, Code::Kind kind) { |
1029 ASSERT(kind == Code::KEYED_CALL_IC); | 1083 ASSERT(kind == Code::KEYED_CALL_IC); |
1030 Code::Flags flags = Code::ComputeFlags(kind, | 1084 Code::Flags flags = Code::ComputeFlags(kind, |
1031 MEGAMORPHIC, | 1085 MEGAMORPHIC, |
1032 Code::kNoExtraICState, | 1086 Code::kNoExtraICState, |
1033 NORMAL, | 1087 NORMAL, |
1034 argc); | 1088 argc); |
1035 Object* probe; | 1089 Object* probe; |
1036 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1090 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1037 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1091 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1038 } | 1092 } |
1039 if (!probe->IsUndefined()) return probe; | 1093 if (!probe->IsUndefined()) return probe; |
1040 StubCompiler compiler; | 1094 HandleScope scope(isolate_); |
| 1095 StubCompiler compiler(isolate_); |
1041 return FillCache(isolate_, compiler.CompileCallArguments(flags)); | 1096 return FillCache(isolate_, compiler.CompileCallArguments(flags)); |
1042 } | 1097 } |
1043 | 1098 |
1044 | 1099 |
1045 MaybeObject* StubCache::ComputeCallMegamorphic( | 1100 MaybeObject* StubCache::ComputeCallMegamorphic( |
1046 int argc, | 1101 int argc, |
1047 Code::Kind kind, | 1102 Code::Kind kind, |
1048 Code::ExtraICState extra_ic_state) { | 1103 Code::ExtraICState extra_ic_state) { |
1049 Code::Flags flags = Code::ComputeFlags(kind, | 1104 Code::Flags flags = Code::ComputeFlags(kind, |
1050 MEGAMORPHIC, | 1105 MEGAMORPHIC, |
1051 extra_ic_state, | 1106 extra_ic_state, |
1052 NORMAL, | 1107 NORMAL, |
1053 argc); | 1108 argc); |
1054 Object* probe; | 1109 Object* probe; |
1055 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1110 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1056 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1111 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1057 } | 1112 } |
1058 if (!probe->IsUndefined()) return probe; | 1113 if (!probe->IsUndefined()) return probe; |
1059 StubCompiler compiler; | 1114 HandleScope scope(isolate_); |
| 1115 StubCompiler compiler(isolate_); |
1060 return FillCache(isolate_, compiler.CompileCallMegamorphic(flags)); | 1116 return FillCache(isolate_, compiler.CompileCallMegamorphic(flags)); |
1061 } | 1117 } |
1062 | 1118 |
1063 | 1119 |
1064 MaybeObject* StubCache::ComputeCallMiss(int argc, | 1120 MaybeObject* StubCache::ComputeCallMiss(int argc, |
1065 Code::Kind kind, | 1121 Code::Kind kind, |
1066 Code::ExtraICState extra_ic_state) { | 1122 Code::ExtraICState extra_ic_state) { |
1067 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs | 1123 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs |
1068 // and monomorphic stubs are not mixed up together in the stub cache. | 1124 // and monomorphic stubs are not mixed up together in the stub cache. |
1069 Code::Flags flags = Code::ComputeFlags(kind, | 1125 Code::Flags flags = Code::ComputeFlags(kind, |
1070 MONOMORPHIC_PROTOTYPE_FAILURE, | 1126 MONOMORPHIC_PROTOTYPE_FAILURE, |
1071 extra_ic_state, | 1127 extra_ic_state, |
1072 NORMAL, | 1128 NORMAL, |
1073 argc, | 1129 argc, |
1074 OWN_MAP); | 1130 OWN_MAP); |
1075 Object* probe; | 1131 Object* probe; |
1076 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1132 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1077 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1133 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1078 } | 1134 } |
1079 if (!probe->IsUndefined()) return probe; | 1135 if (!probe->IsUndefined()) return probe; |
1080 StubCompiler compiler; | 1136 HandleScope scope(isolate_); |
| 1137 StubCompiler compiler(isolate_); |
1081 return FillCache(isolate_, compiler.CompileCallMiss(flags)); | 1138 return FillCache(isolate_, compiler.CompileCallMiss(flags)); |
1082 } | 1139 } |
1083 | 1140 |
1084 | 1141 |
1085 #ifdef ENABLE_DEBUGGER_SUPPORT | 1142 #ifdef ENABLE_DEBUGGER_SUPPORT |
1086 MaybeObject* StubCache::ComputeCallDebugBreak( | 1143 MaybeObject* StubCache::ComputeCallDebugBreak( |
1087 int argc, | 1144 int argc, |
1088 Code::Kind kind) { | 1145 Code::Kind kind) { |
1089 // Extra IC state is irrelevant for debug break ICs. They jump to | 1146 // Extra IC state is irrelevant for debug break ICs. They jump to |
1090 // the actual call ic to carry out the work. | 1147 // the actual call ic to carry out the work. |
1091 Code::Flags flags = Code::ComputeFlags(kind, | 1148 Code::Flags flags = Code::ComputeFlags(kind, |
1092 DEBUG_BREAK, | 1149 DEBUG_BREAK, |
1093 Code::kNoExtraICState, | 1150 Code::kNoExtraICState, |
1094 NORMAL, | 1151 NORMAL, |
1095 argc); | 1152 argc); |
1096 Object* probe; | 1153 Object* probe; |
1097 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1154 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1098 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1155 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1099 } | 1156 } |
1100 if (!probe->IsUndefined()) return probe; | 1157 if (!probe->IsUndefined()) return probe; |
1101 StubCompiler compiler; | 1158 HandleScope scope(isolate_); |
| 1159 StubCompiler compiler(isolate_); |
1102 return FillCache(isolate_, compiler.CompileCallDebugBreak(flags)); | 1160 return FillCache(isolate_, compiler.CompileCallDebugBreak(flags)); |
1103 } | 1161 } |
1104 | 1162 |
1105 | 1163 |
1106 MaybeObject* StubCache::ComputeCallDebugPrepareStepIn( | 1164 MaybeObject* StubCache::ComputeCallDebugPrepareStepIn( |
1107 int argc, | 1165 int argc, |
1108 Code::Kind kind) { | 1166 Code::Kind kind) { |
1109 // Extra IC state is irrelevant for debug break ICs. They jump to | 1167 // Extra IC state is irrelevant for debug break ICs. They jump to |
1110 // the actual call ic to carry out the work. | 1168 // the actual call ic to carry out the work. |
1111 Code::Flags flags = Code::ComputeFlags(kind, | 1169 Code::Flags flags = Code::ComputeFlags(kind, |
1112 DEBUG_PREPARE_STEP_IN, | 1170 DEBUG_PREPARE_STEP_IN, |
1113 Code::kNoExtraICState, | 1171 Code::kNoExtraICState, |
1114 NORMAL, | 1172 NORMAL, |
1115 argc); | 1173 argc); |
1116 Object* probe; | 1174 Object* probe; |
1117 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); | 1175 { MaybeObject* maybe_probe = ProbeCache(isolate_, flags); |
1118 if (!maybe_probe->ToObject(&probe)) return maybe_probe; | 1176 if (!maybe_probe->ToObject(&probe)) return maybe_probe; |
1119 } | 1177 } |
1120 if (!probe->IsUndefined()) return probe; | 1178 if (!probe->IsUndefined()) return probe; |
1121 StubCompiler compiler; | 1179 HandleScope scope(isolate_); |
| 1180 StubCompiler compiler(isolate_); |
1122 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); | 1181 return FillCache(isolate_, compiler.CompileCallDebugPrepareStepIn(flags)); |
1123 } | 1182 } |
1124 #endif | 1183 #endif |
1125 | 1184 |
1126 | 1185 |
1127 void StubCache::Clear() { | 1186 void StubCache::Clear() { |
1128 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); | 1187 Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal); |
1129 for (int i = 0; i < kPrimaryTableSize; i++) { | 1188 for (int i = 0; i < kPrimaryTableSize; i++) { |
1130 primary_[i].key = heap()->empty_string(); | 1189 primary_[i].key = heap()->empty_string(); |
1131 primary_[i].value = empty; | 1190 primary_[i].value = empty; |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 return result; | 1756 return result; |
1698 } | 1757 } |
1699 | 1758 |
1700 | 1759 |
1701 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( | 1760 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( |
1702 MacroAssembler* masm) { | 1761 MacroAssembler* masm) { |
1703 KeyedStoreIC::GenerateSlow(masm); | 1762 KeyedStoreIC::GenerateSlow(masm); |
1704 } | 1763 } |
1705 | 1764 |
1706 | 1765 |
1707 CallStubCompiler::CallStubCompiler(int argc, | 1766 CallStubCompiler::CallStubCompiler(Isolate* isolate, |
| 1767 int argc, |
1708 Code::Kind kind, | 1768 Code::Kind kind, |
1709 Code::ExtraICState extra_ic_state, | 1769 Code::ExtraICState extra_ic_state, |
1710 InlineCacheHolderFlag cache_holder) | 1770 InlineCacheHolderFlag cache_holder) |
1711 : arguments_(argc), | 1771 : StubCompiler(isolate), |
| 1772 arguments_(argc), |
1712 kind_(kind), | 1773 kind_(kind), |
1713 extra_ic_state_(extra_ic_state), | 1774 extra_ic_state_(extra_ic_state), |
1714 cache_holder_(cache_holder) { | 1775 cache_holder_(cache_holder) { |
1715 } | 1776 } |
1716 | 1777 |
1717 | 1778 |
1718 bool CallStubCompiler::HasCustomCallGenerator(JSFunction* function) { | 1779 bool CallStubCompiler::HasCustomCallGenerator(JSFunction* function) { |
1719 SharedFunctionInfo* info = function->shared(); | 1780 SharedFunctionInfo* info = function->shared(); |
1720 if (info->HasBuiltinFunctionId()) { | 1781 if (info->HasBuiltinFunctionId()) { |
1721 BuiltinFunctionId id = info->builtin_function_id(); | 1782 BuiltinFunctionId id = info->builtin_function_id(); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1858 expected_receiver_type_ = | 1919 expected_receiver_type_ = |
1859 FunctionTemplateInfo::cast(signature->receiver()); | 1920 FunctionTemplateInfo::cast(signature->receiver()); |
1860 } | 1921 } |
1861 } | 1922 } |
1862 | 1923 |
1863 is_simple_api_call_ = true; | 1924 is_simple_api_call_ = true; |
1864 } | 1925 } |
1865 | 1926 |
1866 | 1927 |
1867 } } // namespace v8::internal | 1928 } } // namespace v8::internal |
OLD | NEW |