OLD | NEW |
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (receiver->IsGlobalObject()) cache_name = name; | 113 if (receiver->IsGlobalObject()) cache_name = name; |
114 Handle<JSObject> last = receiver; | 114 Handle<JSObject> last = receiver; |
115 while (last->GetPrototype() != heap()->null_value()) { | 115 while (last->GetPrototype() != heap()->null_value()) { |
116 last = Handle<JSObject>(JSObject::cast(last->GetPrototype())); | 116 last = Handle<JSObject>(JSObject::cast(last->GetPrototype())); |
117 if (last->IsGlobalObject()) cache_name = name; | 117 if (last->IsGlobalObject()) cache_name = name; |
118 } | 118 } |
119 // Compile the stub that is either shared for all names or | 119 // Compile the stub that is either shared for all names or |
120 // name specific if there are global objects involved. | 120 // name specific if there are global objects involved. |
121 Code::Flags flags = | 121 Code::Flags flags = |
122 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT); | 122 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NONEXISTENT); |
123 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags)); | 123 Handle<Object> probe(receiver->map()->FindInCodeCache(*cache_name, flags), |
| 124 isolate_); |
124 if (probe->IsCode()) return Handle<Code>::cast(probe); | 125 if (probe->IsCode()) return Handle<Code>::cast(probe); |
125 | 126 |
126 LoadStubCompiler compiler(isolate_); | 127 LoadStubCompiler compiler(isolate_); |
127 Handle<Code> code = | 128 Handle<Code> code = |
128 compiler.CompileLoadNonexistent(cache_name, receiver, last); | 129 compiler.CompileLoadNonexistent(cache_name, receiver, last); |
129 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name)); | 130 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *cache_name)); |
130 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code)); | 131 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *cache_name, *code)); |
131 JSObject::UpdateMapCodeCache(receiver, cache_name, code); | 132 JSObject::UpdateMapCodeCache(receiver, cache_name, code); |
132 return code; | 133 return code; |
133 } | 134 } |
134 | 135 |
135 | 136 |
136 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, | 137 Handle<Code> StubCache::ComputeLoadField(Handle<String> name, |
137 Handle<JSObject> receiver, | 138 Handle<JSObject> receiver, |
138 Handle<JSObject> holder, | 139 Handle<JSObject> holder, |
139 PropertyIndex field_index) { | 140 PropertyIndex field_index) { |
140 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 141 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
141 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD); | 142 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::FIELD); |
142 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 143 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 144 isolate_); |
143 if (probe->IsCode()) return Handle<Code>::cast(probe); | 145 if (probe->IsCode()) return Handle<Code>::cast(probe); |
144 | 146 |
145 LoadStubCompiler compiler(isolate_); | 147 LoadStubCompiler compiler(isolate_); |
146 Handle<Code> code = | 148 Handle<Code> code = |
147 compiler.CompileLoadField(receiver, holder, field_index, name); | 149 compiler.CompileLoadField(receiver, holder, field_index, name); |
148 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 150 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
149 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 151 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
150 JSObject::UpdateMapCodeCache(receiver, name, code); | 152 JSObject::UpdateMapCodeCache(receiver, name, code); |
151 return code; | 153 return code; |
152 } | 154 } |
153 | 155 |
154 | 156 |
155 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, | 157 Handle<Code> StubCache::ComputeLoadCallback(Handle<String> name, |
156 Handle<JSObject> receiver, | 158 Handle<JSObject> receiver, |
157 Handle<JSObject> holder, | 159 Handle<JSObject> holder, |
158 Handle<AccessorInfo> callback) { | 160 Handle<AccessorInfo> callback) { |
159 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); | 161 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); |
160 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 162 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
161 Code::Flags flags = | 163 Code::Flags flags = |
162 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); | 164 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); |
163 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 165 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 166 isolate_); |
164 if (probe->IsCode()) return Handle<Code>::cast(probe); | 167 if (probe->IsCode()) return Handle<Code>::cast(probe); |
165 | 168 |
166 LoadStubCompiler compiler(isolate_); | 169 LoadStubCompiler compiler(isolate_); |
167 Handle<Code> code = | 170 Handle<Code> code = |
168 compiler.CompileLoadCallback(name, receiver, holder, callback); | 171 compiler.CompileLoadCallback(name, receiver, holder, callback); |
169 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 172 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
170 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 173 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
171 JSObject::UpdateMapCodeCache(receiver, name, code); | 174 JSObject::UpdateMapCodeCache(receiver, name, code); |
172 return code; | 175 return code; |
173 } | 176 } |
174 | 177 |
175 | 178 |
176 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name, | 179 Handle<Code> StubCache::ComputeLoadViaGetter(Handle<String> name, |
177 Handle<JSObject> receiver, | 180 Handle<JSObject> receiver, |
178 Handle<JSObject> holder, | 181 Handle<JSObject> holder, |
179 Handle<JSFunction> getter) { | 182 Handle<JSFunction> getter) { |
180 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 183 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
181 Code::Flags flags = | 184 Code::Flags flags = |
182 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); | 185 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CALLBACKS); |
183 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 186 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 187 isolate_); |
184 if (probe->IsCode()) return Handle<Code>::cast(probe); | 188 if (probe->IsCode()) return Handle<Code>::cast(probe); |
185 | 189 |
186 LoadStubCompiler compiler(isolate_); | 190 LoadStubCompiler compiler(isolate_); |
187 Handle<Code> code = | 191 Handle<Code> code = |
188 compiler.CompileLoadViaGetter(name, receiver, holder, getter); | 192 compiler.CompileLoadViaGetter(name, receiver, holder, getter); |
189 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 193 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
190 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 194 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
191 JSObject::UpdateMapCodeCache(receiver, name, code); | 195 JSObject::UpdateMapCodeCache(receiver, name, code); |
192 return code; | 196 return code; |
193 } | 197 } |
194 | 198 |
195 | 199 |
196 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, | 200 Handle<Code> StubCache::ComputeLoadConstant(Handle<String> name, |
197 Handle<JSObject> receiver, | 201 Handle<JSObject> receiver, |
198 Handle<JSObject> holder, | 202 Handle<JSObject> holder, |
199 Handle<JSFunction> value) { | 203 Handle<JSFunction> value) { |
200 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 204 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
201 Code::Flags flags = | 205 Code::Flags flags = |
202 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION); | 206 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::CONSTANT_FUNCTION); |
203 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 207 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 208 isolate_); |
204 if (probe->IsCode()) return Handle<Code>::cast(probe); | 209 if (probe->IsCode()) return Handle<Code>::cast(probe); |
205 | 210 |
206 LoadStubCompiler compiler(isolate_); | 211 LoadStubCompiler compiler(isolate_); |
207 Handle<Code> code = | 212 Handle<Code> code = |
208 compiler.CompileLoadConstant(receiver, holder, value, name); | 213 compiler.CompileLoadConstant(receiver, holder, value, name); |
209 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 214 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
210 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 215 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
211 JSObject::UpdateMapCodeCache(receiver, name, code); | 216 JSObject::UpdateMapCodeCache(receiver, name, code); |
212 return code; | 217 return code; |
213 } | 218 } |
214 | 219 |
215 | 220 |
216 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, | 221 Handle<Code> StubCache::ComputeLoadInterceptor(Handle<String> name, |
217 Handle<JSObject> receiver, | 222 Handle<JSObject> receiver, |
218 Handle<JSObject> holder) { | 223 Handle<JSObject> holder) { |
219 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 224 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
220 Code::Flags flags = | 225 Code::Flags flags = |
221 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR); | 226 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::INTERCEPTOR); |
222 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 227 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 228 isolate_); |
223 if (probe->IsCode()) return Handle<Code>::cast(probe); | 229 if (probe->IsCode()) return Handle<Code>::cast(probe); |
224 | 230 |
225 LoadStubCompiler compiler(isolate_); | 231 LoadStubCompiler compiler(isolate_); |
226 Handle<Code> code = | 232 Handle<Code> code = |
227 compiler.CompileLoadInterceptor(receiver, holder, name); | 233 compiler.CompileLoadInterceptor(receiver, holder, name); |
228 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 234 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
229 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 235 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
230 JSObject::UpdateMapCodeCache(receiver, name, code); | 236 JSObject::UpdateMapCodeCache(receiver, name, code); |
231 return code; | 237 return code; |
232 } | 238 } |
233 | 239 |
234 | 240 |
235 Handle<Code> StubCache::ComputeLoadNormal() { | 241 Handle<Code> StubCache::ComputeLoadNormal() { |
236 return isolate_->builtins()->LoadIC_Normal(); | 242 return isolate_->builtins()->LoadIC_Normal(); |
237 } | 243 } |
238 | 244 |
239 | 245 |
240 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, | 246 Handle<Code> StubCache::ComputeLoadGlobal(Handle<String> name, |
241 Handle<JSObject> receiver, | 247 Handle<JSObject> receiver, |
242 Handle<GlobalObject> holder, | 248 Handle<GlobalObject> holder, |
243 Handle<JSGlobalPropertyCell> cell, | 249 Handle<JSGlobalPropertyCell> cell, |
244 bool is_dont_delete) { | 250 bool is_dont_delete) { |
245 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 251 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
246 Code::Flags flags = | 252 Code::Flags flags = |
247 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL); | 253 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL); |
248 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 254 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 255 isolate_); |
249 if (probe->IsCode()) return Handle<Code>::cast(probe); | 256 if (probe->IsCode()) return Handle<Code>::cast(probe); |
250 | 257 |
251 LoadStubCompiler compiler(isolate_); | 258 LoadStubCompiler compiler(isolate_); |
252 Handle<Code> code = | 259 Handle<Code> code = |
253 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); | 260 compiler.CompileLoadGlobal(receiver, holder, cell, name, is_dont_delete); |
254 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); | 261 PROFILE(isolate_, CodeCreateEvent(Logger::LOAD_IC_TAG, *code, *name)); |
255 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); | 262 GDBJIT(AddCode(GDBJITInterface::LOAD_IC, *name, *code)); |
256 JSObject::UpdateMapCodeCache(receiver, name, code); | 263 JSObject::UpdateMapCodeCache(receiver, name, code); |
257 return code; | 264 return code; |
258 } | 265 } |
259 | 266 |
260 | 267 |
261 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name, | 268 Handle<Code> StubCache::ComputeKeyedLoadField(Handle<String> name, |
262 Handle<JSObject> receiver, | 269 Handle<JSObject> receiver, |
263 Handle<JSObject> holder, | 270 Handle<JSObject> holder, |
264 PropertyIndex field_index) { | 271 PropertyIndex field_index) { |
265 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 272 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
266 Code::Flags flags = | 273 Code::Flags flags = |
267 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD); | 274 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::FIELD); |
268 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 275 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 276 isolate_); |
269 if (probe->IsCode()) return Handle<Code>::cast(probe); | 277 if (probe->IsCode()) return Handle<Code>::cast(probe); |
270 | 278 |
271 KeyedLoadStubCompiler compiler(isolate_); | 279 KeyedLoadStubCompiler compiler(isolate_); |
272 Handle<Code> code = | 280 Handle<Code> code = |
273 compiler.CompileLoadField(name, receiver, holder, field_index); | 281 compiler.CompileLoadField(name, receiver, holder, field_index); |
274 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 282 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
275 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 283 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
276 JSObject::UpdateMapCodeCache(receiver, name, code); | 284 JSObject::UpdateMapCodeCache(receiver, name, code); |
277 return code; | 285 return code; |
278 } | 286 } |
279 | 287 |
280 | 288 |
281 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name, | 289 Handle<Code> StubCache::ComputeKeyedLoadConstant(Handle<String> name, |
282 Handle<JSObject> receiver, | 290 Handle<JSObject> receiver, |
283 Handle<JSObject> holder, | 291 Handle<JSObject> holder, |
284 Handle<JSFunction> value) { | 292 Handle<JSFunction> value) { |
285 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 293 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
286 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, | 294 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, |
287 Code::CONSTANT_FUNCTION); | 295 Code::CONSTANT_FUNCTION); |
288 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 296 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 297 isolate_); |
289 if (probe->IsCode()) return Handle<Code>::cast(probe); | 298 if (probe->IsCode()) return Handle<Code>::cast(probe); |
290 | 299 |
291 KeyedLoadStubCompiler compiler(isolate_); | 300 KeyedLoadStubCompiler compiler(isolate_); |
292 Handle<Code> code = | 301 Handle<Code> code = |
293 compiler.CompileLoadConstant(name, receiver, holder, value); | 302 compiler.CompileLoadConstant(name, receiver, holder, value); |
294 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 303 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
295 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 304 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
296 JSObject::UpdateMapCodeCache(receiver, name, code); | 305 JSObject::UpdateMapCodeCache(receiver, name, code); |
297 return code; | 306 return code; |
298 } | 307 } |
299 | 308 |
300 | 309 |
301 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name, | 310 Handle<Code> StubCache::ComputeKeyedLoadInterceptor(Handle<String> name, |
302 Handle<JSObject> receiver, | 311 Handle<JSObject> receiver, |
303 Handle<JSObject> holder) { | 312 Handle<JSObject> holder) { |
304 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 313 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
305 Code::Flags flags = | 314 Code::Flags flags = |
306 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR); | 315 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::INTERCEPTOR); |
307 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 316 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 317 isolate_); |
308 if (probe->IsCode()) return Handle<Code>::cast(probe); | 318 if (probe->IsCode()) return Handle<Code>::cast(probe); |
309 | 319 |
310 KeyedLoadStubCompiler compiler(isolate_); | 320 KeyedLoadStubCompiler compiler(isolate_); |
311 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name); | 321 Handle<Code> code = compiler.CompileLoadInterceptor(receiver, holder, name); |
312 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 322 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
313 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 323 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
314 JSObject::UpdateMapCodeCache(receiver, name, code); | 324 JSObject::UpdateMapCodeCache(receiver, name, code); |
315 return code; | 325 return code; |
316 } | 326 } |
317 | 327 |
318 | 328 |
319 Handle<Code> StubCache::ComputeKeyedLoadCallback( | 329 Handle<Code> StubCache::ComputeKeyedLoadCallback( |
320 Handle<String> name, | 330 Handle<String> name, |
321 Handle<JSObject> receiver, | 331 Handle<JSObject> receiver, |
322 Handle<JSObject> holder, | 332 Handle<JSObject> holder, |
323 Handle<AccessorInfo> callback) { | 333 Handle<AccessorInfo> callback) { |
324 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); | 334 ASSERT(IC::GetCodeCacheForObject(*receiver, *holder) == OWN_MAP); |
325 Code::Flags flags = | 335 Code::Flags flags = |
326 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); | 336 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); |
327 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 337 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 338 isolate_); |
328 if (probe->IsCode()) return Handle<Code>::cast(probe); | 339 if (probe->IsCode()) return Handle<Code>::cast(probe); |
329 | 340 |
330 KeyedLoadStubCompiler compiler(isolate_); | 341 KeyedLoadStubCompiler compiler(isolate_); |
331 Handle<Code> code = | 342 Handle<Code> code = |
332 compiler.CompileLoadCallback(name, receiver, holder, callback); | 343 compiler.CompileLoadCallback(name, receiver, holder, callback); |
333 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 344 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
334 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 345 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
335 JSObject::UpdateMapCodeCache(receiver, name, code); | 346 JSObject::UpdateMapCodeCache(receiver, name, code); |
336 return code; | 347 return code; |
337 } | 348 } |
338 | 349 |
339 | 350 |
340 Handle<Code> StubCache::ComputeKeyedLoadArrayLength(Handle<String> name, | 351 Handle<Code> StubCache::ComputeKeyedLoadArrayLength(Handle<String> name, |
341 Handle<JSArray> receiver) { | 352 Handle<JSArray> receiver) { |
342 Code::Flags flags = | 353 Code::Flags flags = |
343 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); | 354 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); |
344 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 355 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 356 isolate_); |
345 if (probe->IsCode()) return Handle<Code>::cast(probe); | 357 if (probe->IsCode()) return Handle<Code>::cast(probe); |
346 | 358 |
347 KeyedLoadStubCompiler compiler(isolate_); | 359 KeyedLoadStubCompiler compiler(isolate_); |
348 Handle<Code> code = compiler.CompileLoadArrayLength(name); | 360 Handle<Code> code = compiler.CompileLoadArrayLength(name); |
349 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 361 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
350 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 362 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
351 JSObject::UpdateMapCodeCache(receiver, name, code); | 363 JSObject::UpdateMapCodeCache(receiver, name, code); |
352 return code; | 364 return code; |
353 } | 365 } |
354 | 366 |
355 | 367 |
356 Handle<Code> StubCache::ComputeKeyedLoadStringLength(Handle<String> name, | 368 Handle<Code> StubCache::ComputeKeyedLoadStringLength(Handle<String> name, |
357 Handle<String> receiver) { | 369 Handle<String> receiver) { |
358 Code::Flags flags = | 370 Code::Flags flags = |
359 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); | 371 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); |
360 Handle<Map> map(receiver->map()); | 372 Handle<Map> map(receiver->map()); |
361 Handle<Object> probe(map->FindInCodeCache(*name, flags)); | 373 Handle<Object> probe(map->FindInCodeCache(*name, flags), isolate_); |
362 if (probe->IsCode()) return Handle<Code>::cast(probe); | 374 if (probe->IsCode()) return Handle<Code>::cast(probe); |
363 | 375 |
364 KeyedLoadStubCompiler compiler(isolate_); | 376 KeyedLoadStubCompiler compiler(isolate_); |
365 Handle<Code> code = compiler.CompileLoadStringLength(name); | 377 Handle<Code> code = compiler.CompileLoadStringLength(name); |
366 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 378 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
367 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 379 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
368 Map::UpdateCodeCache(map, name, code); | 380 Map::UpdateCodeCache(map, name, code); |
369 return code; | 381 return code; |
370 } | 382 } |
371 | 383 |
372 | 384 |
373 Handle<Code> StubCache::ComputeKeyedLoadFunctionPrototype( | 385 Handle<Code> StubCache::ComputeKeyedLoadFunctionPrototype( |
374 Handle<String> name, | 386 Handle<String> name, |
375 Handle<JSFunction> receiver) { | 387 Handle<JSFunction> receiver) { |
376 Code::Flags flags = | 388 Code::Flags flags = |
377 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); | 389 Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, Code::CALLBACKS); |
378 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 390 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 391 isolate_); |
379 if (probe->IsCode()) return Handle<Code>::cast(probe); | 392 if (probe->IsCode()) return Handle<Code>::cast(probe); |
380 | 393 |
381 KeyedLoadStubCompiler compiler(isolate_); | 394 KeyedLoadStubCompiler compiler(isolate_); |
382 Handle<Code> code = compiler.CompileLoadFunctionPrototype(name); | 395 Handle<Code> code = compiler.CompileLoadFunctionPrototype(name); |
383 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); | 396 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, *name)); |
384 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); | 397 GDBJIT(AddCode(GDBJITInterface::KEYED_LOAD_IC, *name, *code)); |
385 JSObject::UpdateMapCodeCache(receiver, name, code); | 398 JSObject::UpdateMapCodeCache(receiver, name, code); |
386 return code; | 399 return code; |
387 } | 400 } |
388 | 401 |
389 | 402 |
390 Handle<Code> StubCache::ComputeStoreField(Handle<String> name, | 403 Handle<Code> StubCache::ComputeStoreField(Handle<String> name, |
391 Handle<JSObject> receiver, | 404 Handle<JSObject> receiver, |
392 int field_index, | 405 int field_index, |
393 Handle<Map> transition, | 406 Handle<Map> transition, |
394 StrictModeFlag strict_mode) { | 407 StrictModeFlag strict_mode) { |
395 Code::StubType type = | 408 Code::StubType type = |
396 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; | 409 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; |
397 Code::Flags flags = Code::ComputeMonomorphicFlags( | 410 Code::Flags flags = Code::ComputeMonomorphicFlags( |
398 Code::STORE_IC, type, strict_mode); | 411 Code::STORE_IC, type, strict_mode); |
399 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 412 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 413 isolate_); |
400 if (probe->IsCode()) return Handle<Code>::cast(probe); | 414 if (probe->IsCode()) return Handle<Code>::cast(probe); |
401 | 415 |
402 StoreStubCompiler compiler(isolate_, strict_mode); | 416 StoreStubCompiler compiler(isolate_, strict_mode); |
403 Handle<Code> code = | 417 Handle<Code> code = |
404 compiler.CompileStoreField(receiver, field_index, transition, name); | 418 compiler.CompileStoreField(receiver, field_index, transition, name); |
405 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 419 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
406 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 420 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
407 JSObject::UpdateMapCodeCache(receiver, name, code); | 421 JSObject::UpdateMapCodeCache(receiver, name, code); |
408 return code; | 422 return code; |
409 } | 423 } |
(...skipping 21 matching lines...) Expand all Loading... |
431 case KeyedIC::STORE_NO_TRANSITION: | 445 case KeyedIC::STORE_NO_TRANSITION: |
432 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); | 446 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); |
433 break; | 447 break; |
434 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: | 448 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: |
435 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); | 449 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); |
436 break; | 450 break; |
437 default: | 451 default: |
438 UNREACHABLE(); | 452 UNREACHABLE(); |
439 break; | 453 break; |
440 } | 454 } |
441 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags)); | 455 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); |
442 if (probe->IsCode()) return Handle<Code>::cast(probe); | 456 if (probe->IsCode()) return Handle<Code>::cast(probe); |
443 | 457 |
444 Handle<Code> code; | 458 Handle<Code> code; |
445 switch (stub_kind) { | 459 switch (stub_kind) { |
446 case KeyedIC::LOAD: { | 460 case KeyedIC::LOAD: { |
447 KeyedLoadStubCompiler compiler(isolate_); | 461 KeyedLoadStubCompiler compiler(isolate_); |
448 code = compiler.CompileLoadElement(receiver_map); | 462 code = compiler.CompileLoadElement(receiver_map); |
449 break; | 463 break; |
450 } | 464 } |
451 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: { | 465 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 : isolate_->builtins()->Builtins::StoreIC_Normal(); | 497 : isolate_->builtins()->Builtins::StoreIC_Normal(); |
484 } | 498 } |
485 | 499 |
486 | 500 |
487 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name, | 501 Handle<Code> StubCache::ComputeStoreGlobal(Handle<String> name, |
488 Handle<GlobalObject> receiver, | 502 Handle<GlobalObject> receiver, |
489 Handle<JSGlobalPropertyCell> cell, | 503 Handle<JSGlobalPropertyCell> cell, |
490 StrictModeFlag strict_mode) { | 504 StrictModeFlag strict_mode) { |
491 Code::Flags flags = Code::ComputeMonomorphicFlags( | 505 Code::Flags flags = Code::ComputeMonomorphicFlags( |
492 Code::STORE_IC, Code::NORMAL, strict_mode); | 506 Code::STORE_IC, Code::NORMAL, strict_mode); |
493 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 507 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 508 isolate_); |
494 if (probe->IsCode()) return Handle<Code>::cast(probe); | 509 if (probe->IsCode()) return Handle<Code>::cast(probe); |
495 | 510 |
496 StoreStubCompiler compiler(isolate_, strict_mode); | 511 StoreStubCompiler compiler(isolate_, strict_mode); |
497 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); | 512 Handle<Code> code = compiler.CompileStoreGlobal(receiver, cell, name); |
498 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 513 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
499 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 514 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
500 JSObject::UpdateMapCodeCache(receiver, name, code); | 515 JSObject::UpdateMapCodeCache(receiver, name, code); |
501 return code; | 516 return code; |
502 } | 517 } |
503 | 518 |
504 | 519 |
505 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, | 520 Handle<Code> StubCache::ComputeStoreCallback(Handle<String> name, |
506 Handle<JSObject> receiver, | 521 Handle<JSObject> receiver, |
507 Handle<JSObject> holder, | 522 Handle<JSObject> holder, |
508 Handle<AccessorInfo> callback, | 523 Handle<AccessorInfo> callback, |
509 StrictModeFlag strict_mode) { | 524 StrictModeFlag strict_mode) { |
510 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); | 525 ASSERT(v8::ToCData<Address>(callback->setter()) != 0); |
511 Code::Flags flags = Code::ComputeMonomorphicFlags( | 526 Code::Flags flags = Code::ComputeMonomorphicFlags( |
512 Code::STORE_IC, Code::CALLBACKS, strict_mode); | 527 Code::STORE_IC, Code::CALLBACKS, strict_mode); |
513 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 528 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 529 isolate_); |
514 if (probe->IsCode()) return Handle<Code>::cast(probe); | 530 if (probe->IsCode()) return Handle<Code>::cast(probe); |
515 | 531 |
516 StoreStubCompiler compiler(isolate_, strict_mode); | 532 StoreStubCompiler compiler(isolate_, strict_mode); |
517 Handle<Code> code = | 533 Handle<Code> code = |
518 compiler.CompileStoreCallback(name, receiver, holder, callback); | 534 compiler.CompileStoreCallback(name, receiver, holder, callback); |
519 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 535 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
520 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 536 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
521 JSObject::UpdateMapCodeCache(receiver, name, code); | 537 JSObject::UpdateMapCodeCache(receiver, name, code); |
522 return code; | 538 return code; |
523 } | 539 } |
524 | 540 |
525 | 541 |
526 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<String> name, | 542 Handle<Code> StubCache::ComputeStoreViaSetter(Handle<String> name, |
527 Handle<JSObject> receiver, | 543 Handle<JSObject> receiver, |
528 Handle<JSObject> holder, | 544 Handle<JSObject> holder, |
529 Handle<JSFunction> setter, | 545 Handle<JSFunction> setter, |
530 StrictModeFlag strict_mode) { | 546 StrictModeFlag strict_mode) { |
531 Code::Flags flags = Code::ComputeMonomorphicFlags( | 547 Code::Flags flags = Code::ComputeMonomorphicFlags( |
532 Code::STORE_IC, Code::CALLBACKS, strict_mode); | 548 Code::STORE_IC, Code::CALLBACKS, strict_mode); |
533 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 549 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 550 isolate_); |
534 if (probe->IsCode()) return Handle<Code>::cast(probe); | 551 if (probe->IsCode()) return Handle<Code>::cast(probe); |
535 | 552 |
536 StoreStubCompiler compiler(isolate_, strict_mode); | 553 StoreStubCompiler compiler(isolate_, strict_mode); |
537 Handle<Code> code = | 554 Handle<Code> code = |
538 compiler.CompileStoreViaSetter(name, receiver, holder, setter); | 555 compiler.CompileStoreViaSetter(name, receiver, holder, setter); |
539 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 556 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
540 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 557 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
541 JSObject::UpdateMapCodeCache(receiver, name, code); | 558 JSObject::UpdateMapCodeCache(receiver, name, code); |
542 return code; | 559 return code; |
543 } | 560 } |
544 | 561 |
545 | 562 |
546 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, | 563 Handle<Code> StubCache::ComputeStoreInterceptor(Handle<String> name, |
547 Handle<JSObject> receiver, | 564 Handle<JSObject> receiver, |
548 StrictModeFlag strict_mode) { | 565 StrictModeFlag strict_mode) { |
549 Code::Flags flags = Code::ComputeMonomorphicFlags( | 566 Code::Flags flags = Code::ComputeMonomorphicFlags( |
550 Code::STORE_IC, Code::INTERCEPTOR, strict_mode); | 567 Code::STORE_IC, Code::INTERCEPTOR, strict_mode); |
551 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 568 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 569 isolate_); |
552 if (probe->IsCode()) return Handle<Code>::cast(probe); | 570 if (probe->IsCode()) return Handle<Code>::cast(probe); |
553 | 571 |
554 StoreStubCompiler compiler(isolate_, strict_mode); | 572 StoreStubCompiler compiler(isolate_, strict_mode); |
555 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); | 573 Handle<Code> code = compiler.CompileStoreInterceptor(receiver, name); |
556 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 574 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
557 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 575 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
558 JSObject::UpdateMapCodeCache(receiver, name, code); | 576 JSObject::UpdateMapCodeCache(receiver, name, code); |
559 return code; | 577 return code; |
560 } | 578 } |
561 | 579 |
562 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name, | 580 Handle<Code> StubCache::ComputeKeyedStoreField(Handle<String> name, |
563 Handle<JSObject> receiver, | 581 Handle<JSObject> receiver, |
564 int field_index, | 582 int field_index, |
565 Handle<Map> transition, | 583 Handle<Map> transition, |
566 StrictModeFlag strict_mode) { | 584 StrictModeFlag strict_mode) { |
567 Code::StubType type = | 585 Code::StubType type = |
568 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; | 586 (transition.is_null()) ? Code::FIELD : Code::MAP_TRANSITION; |
569 Code::Flags flags = Code::ComputeMonomorphicFlags( | 587 Code::Flags flags = Code::ComputeMonomorphicFlags( |
570 Code::KEYED_STORE_IC, type, strict_mode); | 588 Code::KEYED_STORE_IC, type, strict_mode); |
571 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 589 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 590 isolate_); |
572 if (probe->IsCode()) return Handle<Code>::cast(probe); | 591 if (probe->IsCode()) return Handle<Code>::cast(probe); |
573 | 592 |
574 KeyedStoreStubCompiler compiler(isolate(), strict_mode, | 593 KeyedStoreStubCompiler compiler(isolate(), strict_mode, |
575 DO_NOT_ALLOW_JSARRAY_GROWTH); | 594 DO_NOT_ALLOW_JSARRAY_GROWTH); |
576 Handle<Code> code = | 595 Handle<Code> code = |
577 compiler.CompileStoreField(receiver, field_index, transition, name); | 596 compiler.CompileStoreField(receiver, field_index, transition, name); |
578 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); | 597 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); |
579 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); | 598 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
580 JSObject::UpdateMapCodeCache(receiver, name, code); | 599 JSObject::UpdateMapCodeCache(receiver, name, code); |
581 return code; | 600 return code; |
(...skipping 21 matching lines...) Expand all Loading... |
603 check = STRING_CHECK; | 622 check = STRING_CHECK; |
604 } else if (object->IsNumber()) { | 623 } else if (object->IsNumber()) { |
605 check = NUMBER_CHECK; | 624 check = NUMBER_CHECK; |
606 } else if (object->IsBoolean()) { | 625 } else if (object->IsBoolean()) { |
607 check = BOOLEAN_CHECK; | 626 check = BOOLEAN_CHECK; |
608 } | 627 } |
609 | 628 |
610 Code::Flags flags = | 629 Code::Flags flags = |
611 Code::ComputeMonomorphicFlags(kind, Code::CONSTANT_FUNCTION, extra_state, | 630 Code::ComputeMonomorphicFlags(kind, Code::CONSTANT_FUNCTION, extra_state, |
612 cache_holder, argc); | 631 cache_holder, argc); |
613 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags)); | 632 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
| 633 isolate_); |
614 if (probe->IsCode()) return Handle<Code>::cast(probe); | 634 if (probe->IsCode()) return Handle<Code>::cast(probe); |
615 | 635 |
616 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); | 636 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); |
617 Handle<Code> code = | 637 Handle<Code> code = |
618 compiler.CompileCallConstant(object, holder, function, name, check); | 638 compiler.CompileCallConstant(object, holder, function, name, check); |
619 code->set_check_type(check); | 639 code->set_check_type(check); |
620 ASSERT_EQ(flags, code->flags()); | 640 ASSERT_EQ(flags, code->flags()); |
621 PROFILE(isolate_, | 641 PROFILE(isolate_, |
622 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 642 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
623 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 643 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
(...skipping 17 matching lines...) Expand all Loading... |
641 // TODO(1233596): We cannot do receiver map check for non-JS objects | 661 // TODO(1233596): We cannot do receiver map check for non-JS objects |
642 // because they may be represented as immediates without a | 662 // because they may be represented as immediates without a |
643 // map. Instead, we check against the map in the holder. | 663 // map. Instead, we check against the map in the holder. |
644 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { | 664 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { |
645 object = holder; | 665 object = holder; |
646 } | 666 } |
647 | 667 |
648 Code::Flags flags = | 668 Code::Flags flags = |
649 Code::ComputeMonomorphicFlags(kind, Code::FIELD, extra_state, | 669 Code::ComputeMonomorphicFlags(kind, Code::FIELD, extra_state, |
650 cache_holder, argc); | 670 cache_holder, argc); |
651 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags)); | 671 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
| 672 isolate_); |
652 if (probe->IsCode()) return Handle<Code>::cast(probe); | 673 if (probe->IsCode()) return Handle<Code>::cast(probe); |
653 | 674 |
654 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); | 675 CallStubCompiler compiler(isolate_, argc, kind, extra_state, cache_holder); |
655 Handle<Code> code = | 676 Handle<Code> code = |
656 compiler.CompileCallField(Handle<JSObject>::cast(object), | 677 compiler.CompileCallField(Handle<JSObject>::cast(object), |
657 holder, index, name); | 678 holder, index, name); |
658 ASSERT_EQ(flags, code->flags()); | 679 ASSERT_EQ(flags, code->flags()); |
659 PROFILE(isolate_, | 680 PROFILE(isolate_, |
660 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 681 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
661 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 682 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
(...skipping 16 matching lines...) Expand all Loading... |
678 // TODO(1233596): We cannot do receiver map check for non-JS objects | 699 // TODO(1233596): We cannot do receiver map check for non-JS objects |
679 // because they may be represented as immediates without a | 700 // because they may be represented as immediates without a |
680 // map. Instead, we check against the map in the holder. | 701 // map. Instead, we check against the map in the holder. |
681 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { | 702 if (object->IsNumber() || object->IsBoolean() || object->IsString()) { |
682 object = holder; | 703 object = holder; |
683 } | 704 } |
684 | 705 |
685 Code::Flags flags = | 706 Code::Flags flags = |
686 Code::ComputeMonomorphicFlags(kind, Code::INTERCEPTOR, extra_state, | 707 Code::ComputeMonomorphicFlags(kind, Code::INTERCEPTOR, extra_state, |
687 cache_holder, argc); | 708 cache_holder, argc); |
688 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags)); | 709 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
| 710 isolate_); |
689 if (probe->IsCode()) return Handle<Code>::cast(probe); | 711 if (probe->IsCode()) return Handle<Code>::cast(probe); |
690 | 712 |
691 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); | 713 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); |
692 Handle<Code> code = | 714 Handle<Code> code = |
693 compiler.CompileCallInterceptor(Handle<JSObject>::cast(object), | 715 compiler.CompileCallInterceptor(Handle<JSObject>::cast(object), |
694 holder, name); | 716 holder, name); |
695 ASSERT_EQ(flags, code->flags()); | 717 ASSERT_EQ(flags, code->flags()); |
696 PROFILE(isolate(), | 718 PROFILE(isolate(), |
697 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 719 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
698 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 720 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
699 JSObject::UpdateMapCodeCache(map_holder, name, code); | 721 JSObject::UpdateMapCodeCache(map_holder, name, code); |
700 return code; | 722 return code; |
701 } | 723 } |
702 | 724 |
703 | 725 |
704 Handle<Code> StubCache::ComputeCallGlobal(int argc, | 726 Handle<Code> StubCache::ComputeCallGlobal(int argc, |
705 Code::Kind kind, | 727 Code::Kind kind, |
706 Code::ExtraICState extra_state, | 728 Code::ExtraICState extra_state, |
707 Handle<String> name, | 729 Handle<String> name, |
708 Handle<JSObject> receiver, | 730 Handle<JSObject> receiver, |
709 Handle<GlobalObject> holder, | 731 Handle<GlobalObject> holder, |
710 Handle<JSGlobalPropertyCell> cell, | 732 Handle<JSGlobalPropertyCell> cell, |
711 Handle<JSFunction> function) { | 733 Handle<JSFunction> function) { |
712 InlineCacheHolderFlag cache_holder = | 734 InlineCacheHolderFlag cache_holder = |
713 IC::GetCodeCacheForObject(*receiver, *holder); | 735 IC::GetCodeCacheForObject(*receiver, *holder); |
714 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); | 736 Handle<JSObject> map_holder(IC::GetCodeCacheHolder(*receiver, cache_holder)); |
715 Code::Flags flags = | 737 Code::Flags flags = |
716 Code::ComputeMonomorphicFlags(kind, Code::NORMAL, extra_state, | 738 Code::ComputeMonomorphicFlags(kind, Code::NORMAL, extra_state, |
717 cache_holder, argc); | 739 cache_holder, argc); |
718 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags)); | 740 Handle<Object> probe(map_holder->map()->FindInCodeCache(*name, flags), |
| 741 isolate_); |
719 if (probe->IsCode()) return Handle<Code>::cast(probe); | 742 if (probe->IsCode()) return Handle<Code>::cast(probe); |
720 | 743 |
721 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); | 744 CallStubCompiler compiler(isolate(), argc, kind, extra_state, cache_holder); |
722 Handle<Code> code = | 745 Handle<Code> code = |
723 compiler.CompileCallGlobal(receiver, holder, cell, function, name); | 746 compiler.CompileCallGlobal(receiver, holder, cell, function, name); |
724 ASSERT_EQ(flags, code->flags()); | 747 ASSERT_EQ(flags, code->flags()); |
725 PROFILE(isolate(), | 748 PROFILE(isolate(), |
726 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 749 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
727 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 750 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
728 JSObject::UpdateMapCodeCache(map_holder, name, code); | 751 JSObject::UpdateMapCodeCache(map_holder, name, code); |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 Handle<FunctionTemplateInfo>( | 1602 Handle<FunctionTemplateInfo>( |
1580 FunctionTemplateInfo::cast(signature->receiver())); | 1603 FunctionTemplateInfo::cast(signature->receiver())); |
1581 } | 1604 } |
1582 } | 1605 } |
1583 | 1606 |
1584 is_simple_api_call_ = true; | 1607 is_simple_api_call_ = true; |
1585 } | 1608 } |
1586 | 1609 |
1587 | 1610 |
1588 } } // namespace v8::internal | 1611 } } // namespace v8::internal |
OLD | NEW |