| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 primary->value = code; | 95 primary->value = code; |
| 96 primary->map = map; | 96 primary->map = map; |
| 97 isolate()->counters()->megamorphic_stub_cache_updates()->Increment(); | 97 isolate()->counters()->megamorphic_stub_cache_updates()->Increment(); |
| 98 return code; | 98 return code; |
| 99 } | 99 } |
| 100 | 100 |
| 101 | 101 |
| 102 Handle<Code> StubCache::FindIC(Handle<Name> name, | 102 Handle<Code> StubCache::FindIC(Handle<Name> name, |
| 103 Handle<Map> stub_holder, | 103 Handle<Map> stub_holder, |
| 104 Code::Kind kind, | 104 Code::Kind kind, |
| 105 Code::ExtraICState extra_state, | 105 ExtraICState extra_state, |
| 106 InlineCacheHolderFlag cache_holder) { | 106 InlineCacheHolderFlag cache_holder) { |
| 107 Code::Flags flags = Code::ComputeMonomorphicFlags( | 107 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 108 kind, extra_state, cache_holder); | 108 kind, extra_state, cache_holder); |
| 109 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); | 109 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); |
| 110 if (probe->IsCode()) return Handle<Code>::cast(probe); | 110 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 111 return Handle<Code>::null(); | 111 return Handle<Code>::null(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 | 114 |
| 115 Handle<Code> StubCache::FindHandler(Handle<Name> name, | 115 Handle<Code> StubCache::FindHandler(Handle<Name> name, |
| 116 Handle<Map> stub_holder, | 116 Handle<Map> stub_holder, |
| 117 Code::Kind kind, | 117 Code::Kind kind, |
| 118 InlineCacheHolderFlag cache_holder, | 118 InlineCacheHolderFlag cache_holder, |
| 119 StrictModeFlag strict_mode) { | 119 StrictModeFlag strict_mode) { |
| 120 Code::ExtraICState extra_ic_state = Code::kNoExtraICState; | 120 ExtraICState extra_ic_state = kNoExtraICState; |
| 121 if (kind == Code::STORE_IC || kind == Code::KEYED_STORE_IC) { | 121 if (kind == Code::STORE_IC) { |
| 122 extra_ic_state = Code::ComputeExtraICState( | 122 extra_ic_state = StoreIC::ComputeExtraICState(strict_mode); |
| 123 STANDARD_STORE, strict_mode); | 123 } else if (kind == Code::KEYED_STORE_IC) { |
| 124 extra_ic_state = KeyedStoreIC::ComputeExtraICState(strict_mode, |
| 125 STANDARD_STORE); |
| 124 } | 126 } |
| 125 Code::Flags flags = Code::ComputeMonomorphicFlags( | 127 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 126 Code::HANDLER, extra_ic_state, cache_holder, Code::NORMAL, kind); | 128 Code::HANDLER, extra_ic_state, cache_holder, Code::NORMAL, kind); |
| 127 | 129 |
| 128 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); | 130 Handle<Object> probe(stub_holder->FindInCodeCache(*name, flags), isolate_); |
| 129 if (probe->IsCode()) return Handle<Code>::cast(probe); | 131 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 130 return Handle<Code>::null(); | 132 return Handle<Code>::null(); |
| 131 } | 133 } |
| 132 | 134 |
| 133 | 135 |
| 134 Handle<Code> StubCache::ComputeMonomorphicIC(Handle<Name> name, | 136 Handle<Code> StubCache::ComputeMonomorphicIC( |
| 135 Handle<Type> type, | 137 Handle<Name> name, |
| 136 Handle<Code> handler, | 138 Handle<Type> type, |
| 137 StrictModeFlag strict_mode) { | 139 Handle<Code> handler, |
| 140 ExtraICState extra_ic_state) { |
| 138 Code::Kind kind = handler->handler_kind(); | 141 Code::Kind kind = handler->handler_kind(); |
| 139 InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type); | 142 InlineCacheHolderFlag flag = IC::GetCodeCacheFlag(*type); |
| 140 | 143 |
| 141 Handle<Map> stub_holder; | 144 Handle<Map> stub_holder; |
| 142 Handle<Code> ic; | 145 Handle<Code> ic; |
| 143 // There are multiple string maps that all use the same prototype. That | 146 // There are multiple string maps that all use the same prototype. That |
| 144 // prototype cannot hold multiple handlers, one for each of the string maps, | 147 // prototype cannot hold multiple handlers, one for each of the string maps, |
| 145 // for a single name. Hence, turn off caching of the IC. | 148 // for a single name. Hence, turn off caching of the IC. |
| 146 bool can_be_cached = !type->Is(Type::String()); | 149 bool can_be_cached = !type->Is(Type::String()); |
| 147 if (can_be_cached) { | 150 if (can_be_cached) { |
| 148 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); | 151 stub_holder = IC::GetCodeCacheHolder(flag, *type, isolate()); |
| 149 ic = FindIC(name, stub_holder, kind, strict_mode, flag); | 152 ic = FindIC(name, stub_holder, kind, extra_ic_state, flag); |
| 150 if (!ic.is_null()) return ic; | 153 if (!ic.is_null()) return ic; |
| 151 } | 154 } |
| 152 | 155 |
| 153 if (kind == Code::LOAD_IC) { | 156 if (kind == Code::LOAD_IC) { |
| 154 LoadStubCompiler ic_compiler(isolate(), flag); | 157 LoadStubCompiler ic_compiler(isolate(), flag); |
| 155 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); | 158 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
| 156 } else if (kind == Code::KEYED_LOAD_IC) { | 159 } else if (kind == Code::KEYED_LOAD_IC) { |
| 157 KeyedLoadStubCompiler ic_compiler(isolate(), flag); | 160 KeyedLoadStubCompiler ic_compiler(isolate(), flag); |
| 158 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); | 161 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
| 159 } else if (kind == Code::STORE_IC) { | 162 } else if (kind == Code::STORE_IC) { |
| 163 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
| 160 StoreStubCompiler ic_compiler(isolate(), strict_mode); | 164 StoreStubCompiler ic_compiler(isolate(), strict_mode); |
| 161 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); | 165 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
| 162 } else { | 166 } else { |
| 163 ASSERT(kind == Code::KEYED_STORE_IC); | 167 ASSERT(kind == Code::KEYED_STORE_IC); |
| 168 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
| 164 KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE); | 169 KeyedStoreStubCompiler ic_compiler(isolate(), strict_mode, STANDARD_STORE); |
| 165 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); | 170 ic = ic_compiler.CompileMonomorphicIC(type, handler, name); |
| 166 } | 171 } |
| 167 | 172 |
| 168 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); | 173 if (can_be_cached) Map::UpdateCodeCache(stub_holder, name, ic); |
| 169 return ic; | 174 return ic; |
| 170 } | 175 } |
| 171 | 176 |
| 172 | 177 |
| 173 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name, | 178 Handle<Code> StubCache::ComputeLoadNonexistent(Handle<Name> name, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 222 |
| 218 Map::UpdateCodeCache(receiver_map, name, code); | 223 Map::UpdateCodeCache(receiver_map, name, code); |
| 219 return code; | 224 return code; |
| 220 } | 225 } |
| 221 | 226 |
| 222 | 227 |
| 223 Handle<Code> StubCache::ComputeKeyedStoreElement( | 228 Handle<Code> StubCache::ComputeKeyedStoreElement( |
| 224 Handle<Map> receiver_map, | 229 Handle<Map> receiver_map, |
| 225 StrictModeFlag strict_mode, | 230 StrictModeFlag strict_mode, |
| 226 KeyedAccessStoreMode store_mode) { | 231 KeyedAccessStoreMode store_mode) { |
| 227 Code::ExtraICState extra_state = | 232 ExtraICState extra_state = |
| 228 Code::ComputeExtraICState(store_mode, strict_mode); | 233 KeyedStoreIC::ComputeExtraICState(strict_mode, store_mode); |
| 229 Code::Flags flags = Code::ComputeMonomorphicFlags( | 234 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 230 Code::KEYED_STORE_IC, extra_state); | 235 Code::KEYED_STORE_IC, extra_state); |
| 231 | 236 |
| 232 ASSERT(store_mode == STANDARD_STORE || | 237 ASSERT(store_mode == STANDARD_STORE || |
| 233 store_mode == STORE_AND_GROW_NO_TRANSITION || | 238 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 234 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 239 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 235 store_mode == STORE_NO_TRANSITION_HANDLE_COW); | 240 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 236 | 241 |
| 237 Handle<String> name = | 242 Handle<String> name = |
| 238 isolate()->factory()->KeyedStoreElementMonomorphic_string(); | 243 isolate()->factory()->KeyedStoreElementMonomorphic_string(); |
| 239 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); | 244 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags), isolate_); |
| 240 if (probe->IsCode()) return Handle<Code>::cast(probe); | 245 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 241 | 246 |
| 242 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); | 247 KeyedStoreStubCompiler compiler(isolate(), strict_mode, store_mode); |
| 243 Handle<Code> code = compiler.CompileStoreElement(receiver_map); | 248 Handle<Code> code = compiler.CompileStoreElement(receiver_map); |
| 244 | 249 |
| 245 Map::UpdateCodeCache(receiver_map, name, code); | 250 Map::UpdateCodeCache(receiver_map, name, code); |
| 246 ASSERT(Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == store_mode); | 251 ASSERT(KeyedStoreIC::GetKeyedAccessStoreMode(code->extra_ic_state()) |
| 252 == store_mode); |
| 247 return code; | 253 return code; |
| 248 } | 254 } |
| 249 | 255 |
| 250 | 256 |
| 251 #define CALL_LOGGER_TAG(kind, type) \ | 257 #define CALL_LOGGER_TAG(kind, type) \ |
| 252 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) | 258 (kind == Code::CALL_IC ? Logger::type : Logger::KEYED_##type) |
| 253 | 259 |
| 254 Handle<Code> StubCache::ComputeCallConstant(int argc, | 260 Handle<Code> StubCache::ComputeCallConstant(int argc, |
| 255 Code::Kind kind, | 261 Code::Kind kind, |
| 256 Code::ExtraICState extra_state, | 262 ExtraICState extra_state, |
| 257 Handle<Name> name, | 263 Handle<Name> name, |
| 258 Handle<Object> object, | 264 Handle<Object> object, |
| 259 Handle<JSObject> holder, | 265 Handle<JSObject> holder, |
| 260 Handle<JSFunction> function) { | 266 Handle<JSFunction> function) { |
| 261 // Compute the check type and the map. | 267 // Compute the check type and the map. |
| 262 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); | 268 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); |
| 263 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( | 269 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( |
| 264 isolate_, *object, cache_holder)); | 270 isolate_, *object, cache_holder)); |
| 265 | 271 |
| 266 // Compute check type based on receiver/holder. | 272 // Compute check type based on receiver/holder. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 | 306 |
| 301 if (CallStubCompiler::CanBeCached(function)) { | 307 if (CallStubCompiler::CanBeCached(function)) { |
| 302 HeapObject::UpdateMapCodeCache(stub_holder, name, code); | 308 HeapObject::UpdateMapCodeCache(stub_holder, name, code); |
| 303 } | 309 } |
| 304 return code; | 310 return code; |
| 305 } | 311 } |
| 306 | 312 |
| 307 | 313 |
| 308 Handle<Code> StubCache::ComputeCallField(int argc, | 314 Handle<Code> StubCache::ComputeCallField(int argc, |
| 309 Code::Kind kind, | 315 Code::Kind kind, |
| 310 Code::ExtraICState extra_state, | 316 ExtraICState extra_state, |
| 311 Handle<Name> name, | 317 Handle<Name> name, |
| 312 Handle<Object> object, | 318 Handle<Object> object, |
| 313 Handle<JSObject> holder, | 319 Handle<JSObject> holder, |
| 314 PropertyIndex index) { | 320 PropertyIndex index) { |
| 315 // Compute the check type and the map. | 321 // Compute the check type and the map. |
| 316 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); | 322 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); |
| 317 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( | 323 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( |
| 318 isolate_, *object, cache_holder)); | 324 isolate_, *object, cache_holder)); |
| 319 | 325 |
| 320 // TODO(1233596): We cannot do receiver map check for non-JS objects | 326 // TODO(1233596): We cannot do receiver map check for non-JS objects |
| (...skipping 18 matching lines...) Expand all Loading... |
| 339 PROFILE(isolate_, | 345 PROFILE(isolate_, |
| 340 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 346 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
| 341 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 347 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
| 342 HeapObject::UpdateMapCodeCache(stub_holder, name, code); | 348 HeapObject::UpdateMapCodeCache(stub_holder, name, code); |
| 343 return code; | 349 return code; |
| 344 } | 350 } |
| 345 | 351 |
| 346 | 352 |
| 347 Handle<Code> StubCache::ComputeCallInterceptor(int argc, | 353 Handle<Code> StubCache::ComputeCallInterceptor(int argc, |
| 348 Code::Kind kind, | 354 Code::Kind kind, |
| 349 Code::ExtraICState extra_state, | 355 ExtraICState extra_state, |
| 350 Handle<Name> name, | 356 Handle<Name> name, |
| 351 Handle<Object> object, | 357 Handle<Object> object, |
| 352 Handle<JSObject> holder) { | 358 Handle<JSObject> holder) { |
| 353 // Compute the check type and the map. | 359 // Compute the check type and the map. |
| 354 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); | 360 InlineCacheHolderFlag cache_holder = IC::GetCodeCacheForObject(*object); |
| 355 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( | 361 Handle<HeapObject> stub_holder(IC::GetCodeCacheHolder( |
| 356 isolate_, *object, cache_holder)); | 362 isolate_, *object, cache_holder)); |
| 357 | 363 |
| 358 // TODO(1233596): We cannot do receiver map check for non-JS objects | 364 // TODO(1233596): We cannot do receiver map check for non-JS objects |
| 359 // because they may be represented as immediates without a | 365 // because they may be represented as immediates without a |
| (...skipping 17 matching lines...) Expand all Loading... |
| 377 PROFILE(isolate(), | 383 PROFILE(isolate(), |
| 378 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); | 384 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG), *code, *name)); |
| 379 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); | 385 GDBJIT(AddCode(GDBJITInterface::CALL_IC, *name, *code)); |
| 380 HeapObject::UpdateMapCodeCache(stub_holder, name, code); | 386 HeapObject::UpdateMapCodeCache(stub_holder, name, code); |
| 381 return code; | 387 return code; |
| 382 } | 388 } |
| 383 | 389 |
| 384 | 390 |
| 385 Handle<Code> StubCache::ComputeCallGlobal(int argc, | 391 Handle<Code> StubCache::ComputeCallGlobal(int argc, |
| 386 Code::Kind kind, | 392 Code::Kind kind, |
| 387 Code::ExtraICState extra_state, | 393 ExtraICState extra_state, |
| 388 Handle<Name> name, | 394 Handle<Name> name, |
| 389 Handle<JSObject> receiver, | 395 Handle<JSObject> receiver, |
| 390 Handle<GlobalObject> holder, | 396 Handle<GlobalObject> holder, |
| 391 Handle<PropertyCell> cell, | 397 Handle<PropertyCell> cell, |
| 392 Handle<JSFunction> function) { | 398 Handle<JSFunction> function) { |
| 393 Code::Flags flags = Code::ComputeMonomorphicFlags( | 399 Code::Flags flags = Code::ComputeMonomorphicFlags( |
| 394 kind, extra_state, OWN_MAP, Code::NORMAL, argc); | 400 kind, extra_state, OWN_MAP, Code::NORMAL, argc); |
| 395 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), | 401 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags), |
| 396 isolate_); | 402 isolate_); |
| 397 if (probe->IsCode()) return Handle<Code>::cast(probe); | 403 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 415 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), | 421 UnseededNumberDictionary::Set(isolate->factory()->non_monomorphic_cache(), |
| 416 code->flags(), | 422 code->flags(), |
| 417 code); | 423 code); |
| 418 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); | 424 isolate->heap()->public_set_non_monomorphic_cache(*dictionary); |
| 419 } | 425 } |
| 420 | 426 |
| 421 | 427 |
| 422 Code* StubCache::FindCallInitialize(int argc, | 428 Code* StubCache::FindCallInitialize(int argc, |
| 423 RelocInfo::Mode mode, | 429 RelocInfo::Mode mode, |
| 424 Code::Kind kind) { | 430 Code::Kind kind) { |
| 425 Code::ExtraICState extra_state = | 431 ExtraICState extra_state = |
| 426 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | | 432 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | |
| 427 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT); | 433 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT |
| 434 ? CONTEXTUAL : NOT_CONTEXTUAL); |
| 428 Code::Flags flags = | 435 Code::Flags flags = |
| 429 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); | 436 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); |
| 430 UnseededNumberDictionary* dictionary = | 437 UnseededNumberDictionary* dictionary = |
| 431 isolate()->heap()->non_monomorphic_cache(); | 438 isolate()->heap()->non_monomorphic_cache(); |
| 432 int entry = dictionary->FindEntry(isolate(), flags); | 439 int entry = dictionary->FindEntry(isolate(), flags); |
| 433 ASSERT(entry != -1); | 440 ASSERT(entry != -1); |
| 434 Object* code = dictionary->ValueAt(entry); | 441 Object* code = dictionary->ValueAt(entry); |
| 435 // This might be called during the marking phase of the collector | 442 // This might be called during the marking phase of the collector |
| 436 // hence the unchecked cast. | 443 // hence the unchecked cast. |
| 437 return reinterpret_cast<Code*>(code); | 444 return reinterpret_cast<Code*>(code); |
| 438 } | 445 } |
| 439 | 446 |
| 440 | 447 |
| 441 Handle<Code> StubCache::ComputeCallInitialize(int argc, | 448 Handle<Code> StubCache::ComputeCallInitialize(int argc, |
| 442 RelocInfo::Mode mode, | 449 RelocInfo::Mode mode, |
| 443 Code::Kind kind) { | 450 Code::Kind kind) { |
| 444 Code::ExtraICState extra_state = | 451 ExtraICState extra_state = |
| 445 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | | 452 CallICBase::StringStubState::encode(DEFAULT_STRING_STUB) | |
| 446 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT); | 453 CallICBase::Contextual::encode(mode == RelocInfo::CODE_TARGET_CONTEXT |
| 454 ? CONTEXTUAL : NOT_CONTEXTUAL); |
| 447 Code::Flags flags = | 455 Code::Flags flags = |
| 448 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); | 456 Code::ComputeFlags(kind, UNINITIALIZED, extra_state, Code::NORMAL, argc); |
| 449 Handle<UnseededNumberDictionary> cache = | 457 Handle<UnseededNumberDictionary> cache = |
| 450 isolate_->factory()->non_monomorphic_cache(); | 458 isolate_->factory()->non_monomorphic_cache(); |
| 451 int entry = cache->FindEntry(isolate_, flags); | 459 int entry = cache->FindEntry(isolate_, flags); |
| 452 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 460 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 453 | 461 |
| 454 StubCompiler compiler(isolate_); | 462 StubCompiler compiler(isolate_); |
| 455 Handle<Code> code = compiler.CompileCallInitialize(flags); | 463 Handle<Code> code = compiler.CompileCallInitialize(flags); |
| 456 FillCache(isolate_, code); | 464 FillCache(isolate_, code); |
| 457 return code; | 465 return code; |
| 458 } | 466 } |
| 459 | 467 |
| 460 | 468 |
| 461 Handle<Code> StubCache::ComputeCallInitialize(int argc, RelocInfo::Mode mode) { | 469 Handle<Code> StubCache::ComputeCallInitialize(int argc, RelocInfo::Mode mode) { |
| 462 return ComputeCallInitialize(argc, mode, Code::CALL_IC); | 470 return ComputeCallInitialize(argc, mode, Code::CALL_IC); |
| 463 } | 471 } |
| 464 | 472 |
| 465 | 473 |
| 466 Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) { | 474 Handle<Code> StubCache::ComputeKeyedCallInitialize(int argc) { |
| 467 return ComputeCallInitialize(argc, RelocInfo::CODE_TARGET, | 475 return ComputeCallInitialize(argc, RelocInfo::CODE_TARGET, |
| 468 Code::KEYED_CALL_IC); | 476 Code::KEYED_CALL_IC); |
| 469 } | 477 } |
| 470 | 478 |
| 471 | 479 |
| 472 Handle<Code> StubCache::ComputeCallPreMonomorphic( | 480 Handle<Code> StubCache::ComputeCallPreMonomorphic( |
| 473 int argc, | 481 int argc, |
| 474 Code::Kind kind, | 482 Code::Kind kind, |
| 475 Code::ExtraICState extra_state) { | 483 ExtraICState extra_state) { |
| 476 Code::Flags flags = | 484 Code::Flags flags = |
| 477 Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, Code::NORMAL, argc); | 485 Code::ComputeFlags(kind, PREMONOMORPHIC, extra_state, Code::NORMAL, argc); |
| 478 Handle<UnseededNumberDictionary> cache = | 486 Handle<UnseededNumberDictionary> cache = |
| 479 isolate_->factory()->non_monomorphic_cache(); | 487 isolate_->factory()->non_monomorphic_cache(); |
| 480 int entry = cache->FindEntry(isolate_, flags); | 488 int entry = cache->FindEntry(isolate_, flags); |
| 481 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 489 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 482 | 490 |
| 483 StubCompiler compiler(isolate_); | 491 StubCompiler compiler(isolate_); |
| 484 Handle<Code> code = compiler.CompileCallPreMonomorphic(flags); | 492 Handle<Code> code = compiler.CompileCallPreMonomorphic(flags); |
| 485 FillCache(isolate_, code); | 493 FillCache(isolate_, code); |
| 486 return code; | 494 return code; |
| 487 } | 495 } |
| 488 | 496 |
| 489 | 497 |
| 490 Handle<Code> StubCache::ComputeCallNormal(int argc, | 498 Handle<Code> StubCache::ComputeCallNormal(int argc, |
| 491 Code::Kind kind, | 499 Code::Kind kind, |
| 492 Code::ExtraICState extra_state) { | 500 ExtraICState extra_state) { |
| 493 Code::Flags flags = | 501 Code::Flags flags = |
| 494 Code::ComputeFlags(kind, MONOMORPHIC, extra_state, Code::NORMAL, argc); | 502 Code::ComputeFlags(kind, MONOMORPHIC, extra_state, Code::NORMAL, argc); |
| 495 Handle<UnseededNumberDictionary> cache = | 503 Handle<UnseededNumberDictionary> cache = |
| 496 isolate_->factory()->non_monomorphic_cache(); | 504 isolate_->factory()->non_monomorphic_cache(); |
| 497 int entry = cache->FindEntry(isolate_, flags); | 505 int entry = cache->FindEntry(isolate_, flags); |
| 498 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 506 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 499 | 507 |
| 500 StubCompiler compiler(isolate_); | 508 StubCompiler compiler(isolate_); |
| 501 Handle<Code> code = compiler.CompileCallNormal(flags); | 509 Handle<Code> code = compiler.CompileCallNormal(flags); |
| 502 FillCache(isolate_, code); | 510 FillCache(isolate_, code); |
| 503 return code; | 511 return code; |
| 504 } | 512 } |
| 505 | 513 |
| 506 | 514 |
| 507 Handle<Code> StubCache::ComputeCallArguments(int argc) { | 515 Handle<Code> StubCache::ComputeCallArguments(int argc) { |
| 508 Code::Flags flags = | 516 Code::Flags flags = |
| 509 Code::ComputeFlags(Code::KEYED_CALL_IC, MEGAMORPHIC, | 517 Code::ComputeFlags(Code::KEYED_CALL_IC, MEGAMORPHIC, |
| 510 Code::kNoExtraICState, Code::NORMAL, argc); | 518 kNoExtraICState, Code::NORMAL, argc); |
| 511 Handle<UnseededNumberDictionary> cache = | 519 Handle<UnseededNumberDictionary> cache = |
| 512 isolate_->factory()->non_monomorphic_cache(); | 520 isolate_->factory()->non_monomorphic_cache(); |
| 513 int entry = cache->FindEntry(isolate_, flags); | 521 int entry = cache->FindEntry(isolate_, flags); |
| 514 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 522 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 515 | 523 |
| 516 StubCompiler compiler(isolate_); | 524 StubCompiler compiler(isolate_); |
| 517 Handle<Code> code = compiler.CompileCallArguments(flags); | 525 Handle<Code> code = compiler.CompileCallArguments(flags); |
| 518 FillCache(isolate_, code); | 526 FillCache(isolate_, code); |
| 519 return code; | 527 return code; |
| 520 } | 528 } |
| 521 | 529 |
| 522 | 530 |
| 523 Handle<Code> StubCache::ComputeCallMegamorphic( | 531 Handle<Code> StubCache::ComputeCallMegamorphic( |
| 524 int argc, | 532 int argc, |
| 525 Code::Kind kind, | 533 Code::Kind kind, |
| 526 Code::ExtraICState extra_state) { | 534 ExtraICState extra_state) { |
| 527 Code::Flags flags = | 535 Code::Flags flags = |
| 528 Code::ComputeFlags(kind, MEGAMORPHIC, extra_state, | 536 Code::ComputeFlags(kind, MEGAMORPHIC, extra_state, |
| 529 Code::NORMAL, argc); | 537 Code::NORMAL, argc); |
| 530 Handle<UnseededNumberDictionary> cache = | 538 Handle<UnseededNumberDictionary> cache = |
| 531 isolate_->factory()->non_monomorphic_cache(); | 539 isolate_->factory()->non_monomorphic_cache(); |
| 532 int entry = cache->FindEntry(isolate_, flags); | 540 int entry = cache->FindEntry(isolate_, flags); |
| 533 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 541 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 534 | 542 |
| 535 StubCompiler compiler(isolate_); | 543 StubCompiler compiler(isolate_); |
| 536 Handle<Code> code = compiler.CompileCallMegamorphic(flags); | 544 Handle<Code> code = compiler.CompileCallMegamorphic(flags); |
| 537 FillCache(isolate_, code); | 545 FillCache(isolate_, code); |
| 538 return code; | 546 return code; |
| 539 } | 547 } |
| 540 | 548 |
| 541 | 549 |
| 542 Handle<Code> StubCache::ComputeCallMiss(int argc, | 550 Handle<Code> StubCache::ComputeCallMiss(int argc, |
| 543 Code::Kind kind, | 551 Code::Kind kind, |
| 544 Code::ExtraICState extra_state) { | 552 ExtraICState extra_state) { |
| 545 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs | 553 // MONOMORPHIC_PROTOTYPE_FAILURE state is used to make sure that miss stubs |
| 546 // and monomorphic stubs are not mixed up together in the stub cache. | 554 // and monomorphic stubs are not mixed up together in the stub cache. |
| 547 Code::Flags flags = | 555 Code::Flags flags = |
| 548 Code::ComputeFlags(kind, MONOMORPHIC_PROTOTYPE_FAILURE, extra_state, | 556 Code::ComputeFlags(kind, MONOMORPHIC_PROTOTYPE_FAILURE, extra_state, |
| 549 Code::NORMAL, argc, OWN_MAP); | 557 Code::NORMAL, argc, OWN_MAP); |
| 550 Handle<UnseededNumberDictionary> cache = | 558 Handle<UnseededNumberDictionary> cache = |
| 551 isolate_->factory()->non_monomorphic_cache(); | 559 isolate_->factory()->non_monomorphic_cache(); |
| 552 int entry = cache->FindEntry(isolate_, flags); | 560 int entry = cache->FindEntry(isolate_, flags); |
| 553 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); | 561 if (entry != -1) return Handle<Code>(Code::cast(cache->ValueAt(entry))); |
| 554 | 562 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 Handle<Code> code = compiler.CompilePolymorphicIC( | 606 Handle<Code> code = compiler.CompilePolymorphicIC( |
| 599 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT); | 607 &types, &handlers, factory()->empty_string(), Code::NORMAL, ELEMENT); |
| 600 | 608 |
| 601 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); | 609 isolate()->counters()->keyed_load_polymorphic_stubs()->Increment(); |
| 602 | 610 |
| 603 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); | 611 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
| 604 return code; | 612 return code; |
| 605 } | 613 } |
| 606 | 614 |
| 607 | 615 |
| 608 Handle<Code> StubCache::ComputePolymorphicIC(TypeHandleList* types, | 616 Handle<Code> StubCache::ComputePolymorphicIC( |
| 609 CodeHandleList* handlers, | 617 TypeHandleList* types, |
| 610 int number_of_valid_types, | 618 CodeHandleList* handlers, |
| 611 Handle<Name> name, | 619 int number_of_valid_types, |
| 612 StrictModeFlag strict_mode) { | 620 Handle<Name> name, |
| 621 ExtraICState extra_ic_state) { |
| 622 |
| 613 Handle<Code> handler = handlers->at(0); | 623 Handle<Code> handler = handlers->at(0); |
| 614 Code::Kind kind = handler->handler_kind(); | 624 Code::Kind kind = handler->handler_kind(); |
| 615 Code::StubType type = number_of_valid_types == 1 ? handler->type() | 625 Code::StubType type = number_of_valid_types == 1 ? handler->type() |
| 616 : Code::NORMAL; | 626 : Code::NORMAL; |
| 617 if (kind == Code::LOAD_IC) { | 627 if (kind == Code::LOAD_IC) { |
| 618 LoadStubCompiler ic_compiler(isolate_); | 628 LoadStubCompiler ic_compiler(isolate_); |
| 619 return ic_compiler.CompilePolymorphicIC( | 629 return ic_compiler.CompilePolymorphicIC( |
| 620 types, handlers, name, type, PROPERTY); | 630 types, handlers, name, type, PROPERTY); |
| 621 } else { | 631 } else { |
| 622 ASSERT(kind == Code::STORE_IC); | 632 ASSERT(kind == Code::STORE_IC); |
| 633 StrictModeFlag strict_mode = StoreIC::GetStrictMode(extra_ic_state); |
| 623 StoreStubCompiler ic_compiler(isolate_, strict_mode); | 634 StoreStubCompiler ic_compiler(isolate_, strict_mode); |
| 624 return ic_compiler.CompilePolymorphicIC( | 635 return ic_compiler.CompilePolymorphicIC( |
| 625 types, handlers, name, type, PROPERTY); | 636 types, handlers, name, type, PROPERTY); |
| 626 } | 637 } |
| 627 } | 638 } |
| 628 | 639 |
| 629 | 640 |
| 630 Handle<Code> StubCache::ComputeStoreElementPolymorphic( | 641 Handle<Code> StubCache::ComputeStoreElementPolymorphic( |
| 631 MapHandleList* receiver_maps, | 642 MapHandleList* receiver_maps, |
| 632 KeyedAccessStoreMode store_mode, | 643 KeyedAccessStoreMode store_mode, |
| 633 StrictModeFlag strict_mode) { | 644 StrictModeFlag strict_mode) { |
| 634 ASSERT(store_mode == STANDARD_STORE || | 645 ASSERT(store_mode == STANDARD_STORE || |
| 635 store_mode == STORE_AND_GROW_NO_TRANSITION || | 646 store_mode == STORE_AND_GROW_NO_TRANSITION || |
| 636 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || | 647 store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS || |
| 637 store_mode == STORE_NO_TRANSITION_HANDLE_COW); | 648 store_mode == STORE_NO_TRANSITION_HANDLE_COW); |
| 638 Handle<PolymorphicCodeCache> cache = | 649 Handle<PolymorphicCodeCache> cache = |
| 639 isolate_->factory()->polymorphic_code_cache(); | 650 isolate_->factory()->polymorphic_code_cache(); |
| 640 Code::ExtraICState extra_state = Code::ComputeExtraICState(store_mode, | 651 ExtraICState extra_state = KeyedStoreIC::ComputeExtraICState( |
| 641 strict_mode); | 652 strict_mode, store_mode); |
| 642 Code::Flags flags = | 653 Code::Flags flags = |
| 643 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); | 654 Code::ComputeFlags(Code::KEYED_STORE_IC, POLYMORPHIC, extra_state); |
| 644 Handle<Object> probe = cache->Lookup(receiver_maps, flags); | 655 Handle<Object> probe = cache->Lookup(receiver_maps, flags); |
| 645 if (probe->IsCode()) return Handle<Code>::cast(probe); | 656 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 646 | 657 |
| 647 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); | 658 KeyedStoreStubCompiler compiler(isolate_, strict_mode, store_mode); |
| 648 Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps); | 659 Handle<Code> code = compiler.CompileStoreElementPolymorphic(receiver_maps); |
| 649 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); | 660 PolymorphicCodeCache::Update(cache, receiver_maps, flags, code); |
| 650 return code; | 661 return code; |
| 651 } | 662 } |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 JSObject* receiver = JSObject::cast(args[0]); | 951 JSObject* receiver = JSObject::cast(args[0]); |
| 941 ASSERT(args.smi_at(1) >= 0); | 952 ASSERT(args.smi_at(1) >= 0); |
| 942 uint32_t index = args.smi_at(1); | 953 uint32_t index = args.smi_at(1); |
| 943 return receiver->GetElementWithInterceptor(receiver, index); | 954 return receiver->GetElementWithInterceptor(receiver, index); |
| 944 } | 955 } |
| 945 | 956 |
| 946 | 957 |
| 947 Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) { | 958 Handle<Code> StubCompiler::CompileCallInitialize(Code::Flags flags) { |
| 948 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 959 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 949 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 960 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
| 950 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 961 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
| 951 if (kind == Code::CALL_IC) { | 962 if (kind == Code::CALL_IC) { |
| 952 CallIC::GenerateInitialize(masm(), argc, extra_state); | 963 CallIC::GenerateInitialize(masm(), argc, extra_state); |
| 953 } else { | 964 } else { |
| 954 KeyedCallIC::GenerateInitialize(masm(), argc); | 965 KeyedCallIC::GenerateInitialize(masm(), argc); |
| 955 } | 966 } |
| 956 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallInitialize"); | 967 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallInitialize"); |
| 957 isolate()->counters()->call_initialize_stubs()->Increment(); | 968 isolate()->counters()->call_initialize_stubs()->Increment(); |
| 958 PROFILE(isolate(), | 969 PROFILE(isolate(), |
| 959 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), | 970 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_INITIALIZE_TAG), |
| 960 *code, code->arguments_count())); | 971 *code, code->arguments_count())); |
| 961 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code)); | 972 GDBJIT(AddCode(GDBJITInterface::CALL_INITIALIZE, *code)); |
| 962 return code; | 973 return code; |
| 963 } | 974 } |
| 964 | 975 |
| 965 | 976 |
| 966 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { | 977 Handle<Code> StubCompiler::CompileCallPreMonomorphic(Code::Flags flags) { |
| 967 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 978 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 968 // The code of the PreMonomorphic stub is the same as the code | 979 // The code of the PreMonomorphic stub is the same as the code |
| 969 // of the Initialized stub. They just differ on the code object flags. | 980 // of the Initialized stub. They just differ on the code object flags. |
| 970 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 981 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
| 971 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 982 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
| 972 if (kind == Code::CALL_IC) { | 983 if (kind == Code::CALL_IC) { |
| 973 CallIC::GenerateInitialize(masm(), argc, extra_state); | 984 CallIC::GenerateInitialize(masm(), argc, extra_state); |
| 974 } else { | 985 } else { |
| 975 KeyedCallIC::GenerateInitialize(masm(), argc); | 986 KeyedCallIC::GenerateInitialize(masm(), argc); |
| 976 } | 987 } |
| 977 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); | 988 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallPreMonomorphic"); |
| 978 isolate()->counters()->call_premonomorphic_stubs()->Increment(); | 989 isolate()->counters()->call_premonomorphic_stubs()->Increment(); |
| 979 PROFILE(isolate(), | 990 PROFILE(isolate(), |
| 980 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), | 991 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_PRE_MONOMORPHIC_TAG), |
| 981 *code, code->arguments_count())); | 992 *code, code->arguments_count())); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1001 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), | 1012 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_NORMAL_TAG), |
| 1002 *code, code->arguments_count())); | 1013 *code, code->arguments_count())); |
| 1003 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code)); | 1014 GDBJIT(AddCode(GDBJITInterface::CALL_NORMAL, *code)); |
| 1004 return code; | 1015 return code; |
| 1005 } | 1016 } |
| 1006 | 1017 |
| 1007 | 1018 |
| 1008 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { | 1019 Handle<Code> StubCompiler::CompileCallMegamorphic(Code::Flags flags) { |
| 1009 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1020 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 1010 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1021 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
| 1011 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1022 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
| 1012 if (kind == Code::CALL_IC) { | 1023 if (kind == Code::CALL_IC) { |
| 1013 CallIC::GenerateMegamorphic(masm(), argc, extra_state); | 1024 CallIC::GenerateMegamorphic(masm(), argc, extra_state); |
| 1014 } else { | 1025 } else { |
| 1015 KeyedCallIC::GenerateMegamorphic(masm(), argc); | 1026 KeyedCallIC::GenerateMegamorphic(masm(), argc); |
| 1016 } | 1027 } |
| 1017 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic"); | 1028 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMegamorphic"); |
| 1018 isolate()->counters()->call_megamorphic_stubs()->Increment(); | 1029 isolate()->counters()->call_megamorphic_stubs()->Increment(); |
| 1019 PROFILE(isolate(), | 1030 PROFILE(isolate(), |
| 1020 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), | 1031 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MEGAMORPHIC_TAG), |
| 1021 *code, code->arguments_count())); | 1032 *code, code->arguments_count())); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1033 CALL_MEGAMORPHIC_TAG), | 1044 CALL_MEGAMORPHIC_TAG), |
| 1034 *code, code->arguments_count())); | 1045 *code, code->arguments_count())); |
| 1035 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); | 1046 GDBJIT(AddCode(GDBJITInterface::CALL_MEGAMORPHIC, *code)); |
| 1036 return code; | 1047 return code; |
| 1037 } | 1048 } |
| 1038 | 1049 |
| 1039 | 1050 |
| 1040 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { | 1051 Handle<Code> StubCompiler::CompileCallMiss(Code::Flags flags) { |
| 1041 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1052 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 1042 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1053 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
| 1043 Code::ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); | 1054 ExtraICState extra_state = Code::ExtractExtraICStateFromFlags(flags); |
| 1044 if (kind == Code::CALL_IC) { | 1055 if (kind == Code::CALL_IC) { |
| 1045 CallIC::GenerateMiss(masm(), argc, extra_state); | 1056 CallIC::GenerateMiss(masm(), argc, extra_state); |
| 1046 } else { | 1057 } else { |
| 1047 KeyedCallIC::GenerateMiss(masm(), argc); | 1058 KeyedCallIC::GenerateMiss(masm(), argc); |
| 1048 } | 1059 } |
| 1049 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss"); | 1060 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallMiss"); |
| 1050 isolate()->counters()->call_megamorphic_stubs()->Increment(); | 1061 isolate()->counters()->call_megamorphic_stubs()->Increment(); |
| 1051 PROFILE(isolate(), | 1062 PROFILE(isolate(), |
| 1052 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), | 1063 CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_MISS_TAG), |
| 1053 *code, code->arguments_count())); | 1064 *code, code->arguments_count())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1068 } | 1079 } |
| 1069 | 1080 |
| 1070 | 1081 |
| 1071 Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { | 1082 Handle<Code> StubCompiler::CompileCallDebugPrepareStepIn(Code::Flags flags) { |
| 1072 // Use the same code for the the step in preparations as we do for the | 1083 // Use the same code for the the step in preparations as we do for the |
| 1073 // miss case. | 1084 // miss case. |
| 1074 int argc = Code::ExtractArgumentsCountFromFlags(flags); | 1085 int argc = Code::ExtractArgumentsCountFromFlags(flags); |
| 1075 Code::Kind kind = Code::ExtractKindFromFlags(flags); | 1086 Code::Kind kind = Code::ExtractKindFromFlags(flags); |
| 1076 if (kind == Code::CALL_IC) { | 1087 if (kind == Code::CALL_IC) { |
| 1077 // For the debugger extra ic state is irrelevant. | 1088 // For the debugger extra ic state is irrelevant. |
| 1078 CallIC::GenerateMiss(masm(), argc, Code::kNoExtraICState); | 1089 CallIC::GenerateMiss(masm(), argc, kNoExtraICState); |
| 1079 } else { | 1090 } else { |
| 1080 KeyedCallIC::GenerateMiss(masm(), argc); | 1091 KeyedCallIC::GenerateMiss(masm(), argc); |
| 1081 } | 1092 } |
| 1082 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); | 1093 Handle<Code> code = GetCodeWithFlags(flags, "CompileCallDebugPrepareStepIn"); |
| 1083 PROFILE(isolate(), | 1094 PROFILE(isolate(), |
| 1084 CodeCreateEvent( | 1095 CodeCreateEvent( |
| 1085 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), | 1096 CALL_LOGGER_TAG(kind, CALL_DEBUG_PREPARE_STEP_IN_TAG), |
| 1086 *code, | 1097 *code, |
| 1087 code->arguments_count())); | 1098 code->arguments_count())); |
| 1088 return code; | 1099 return code; |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 | 1683 |
| 1673 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( | 1684 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( |
| 1674 MacroAssembler* masm) { | 1685 MacroAssembler* masm) { |
| 1675 KeyedStoreIC::GenerateSlow(masm); | 1686 KeyedStoreIC::GenerateSlow(masm); |
| 1676 } | 1687 } |
| 1677 | 1688 |
| 1678 | 1689 |
| 1679 CallStubCompiler::CallStubCompiler(Isolate* isolate, | 1690 CallStubCompiler::CallStubCompiler(Isolate* isolate, |
| 1680 int argc, | 1691 int argc, |
| 1681 Code::Kind kind, | 1692 Code::Kind kind, |
| 1682 Code::ExtraICState extra_state, | 1693 ExtraICState extra_state, |
| 1683 InlineCacheHolderFlag cache_holder) | 1694 InlineCacheHolderFlag cache_holder) |
| 1684 : StubCompiler(isolate), | 1695 : StubCompiler(isolate), |
| 1685 arguments_(argc), | 1696 arguments_(argc), |
| 1686 kind_(kind), | 1697 kind_(kind), |
| 1687 extra_state_(extra_state), | 1698 extra_state_(extra_state), |
| 1688 cache_holder_(cache_holder) { | 1699 cache_holder_(cache_holder) { |
| 1689 } | 1700 } |
| 1690 | 1701 |
| 1691 | 1702 |
| 1692 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) { | 1703 bool CallStubCompiler::HasCustomCallGenerator(Handle<JSFunction> function) { |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 Handle<FunctionTemplateInfo>( | 1844 Handle<FunctionTemplateInfo>( |
| 1834 FunctionTemplateInfo::cast(signature->receiver())); | 1845 FunctionTemplateInfo::cast(signature->receiver())); |
| 1835 } | 1846 } |
| 1836 } | 1847 } |
| 1837 | 1848 |
| 1838 is_simple_api_call_ = true; | 1849 is_simple_api_call_ = true; |
| 1839 } | 1850 } |
| 1840 | 1851 |
| 1841 | 1852 |
| 1842 } } // namespace v8::internal | 1853 } } // namespace v8::internal |
| OLD | NEW |