| 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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 Handle<Code> code = | 377 Handle<Code> code = |
| 378 compiler.CompileStoreField(receiver, field_index, transition, name); | 378 compiler.CompileStoreField(receiver, field_index, transition, name); |
| 379 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 379 PROFILE(isolate_, CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
| 380 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 380 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
| 381 JSObject::UpdateMapCodeCache(receiver, name, code); | 381 JSObject::UpdateMapCodeCache(receiver, name, code); |
| 382 return code; | 382 return code; |
| 383 } | 383 } |
| 384 | 384 |
| 385 | 385 |
| 386 Handle<Code> StubCache::ComputeKeyedLoadOrStoreElement( | 386 Handle<Code> StubCache::ComputeKeyedLoadOrStoreElement( |
| 387 Handle<JSObject> receiver, | 387 Handle<Map> receiver_map, |
| 388 KeyedIC::StubKind stub_kind, | 388 KeyedIC::StubKind stub_kind, |
| 389 StrictModeFlag strict_mode) { | 389 StrictModeFlag strict_mode) { |
| 390 KeyedAccessGrowMode grow_mode = | 390 KeyedAccessGrowMode grow_mode = |
| 391 KeyedIC::GetGrowModeFromStubKind(stub_kind); | 391 KeyedIC::GetGrowModeFromStubKind(stub_kind); |
| 392 Code::ExtraICState extra_state = | 392 Code::ExtraICState extra_state = |
| 393 Code::ComputeExtraICState(grow_mode, strict_mode); | 393 Code::ComputeExtraICState(grow_mode, strict_mode); |
| 394 Code::Flags flags = | 394 Code::Flags flags = |
| 395 Code::ComputeMonomorphicFlags( | 395 Code::ComputeMonomorphicFlags( |
| 396 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC | 396 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC |
| 397 : Code::KEYED_STORE_IC, | 397 : Code::KEYED_STORE_IC, |
| 398 NORMAL, | 398 NORMAL, |
| 399 extra_state); | 399 extra_state); |
| 400 Handle<String> name; | 400 Handle<String> name; |
| 401 switch (stub_kind) { | 401 switch (stub_kind) { |
| 402 case KeyedIC::LOAD: | 402 case KeyedIC::LOAD: |
| 403 name = isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); | 403 name = isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); |
| 404 break; | 404 break; |
| 405 case KeyedIC::STORE_NO_TRANSITION: | 405 case KeyedIC::STORE_NO_TRANSITION: |
| 406 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); | 406 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); |
| 407 break; | 407 break; |
| 408 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: | 408 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: |
| 409 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); | 409 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); |
| 410 break; | 410 break; |
| 411 default: | 411 default: |
| 412 UNREACHABLE(); | 412 UNREACHABLE(); |
| 413 break; | 413 break; |
| 414 } | 414 } |
| 415 Handle<Map> receiver_map(receiver->map()); | |
| 416 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags)); | 415 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags)); |
| 417 if (probe->IsCode()) return Handle<Code>::cast(probe); | 416 if (probe->IsCode()) return Handle<Code>::cast(probe); |
| 418 | 417 |
| 419 Handle<Code> code; | 418 Handle<Code> code; |
| 420 switch (stub_kind) { | 419 switch (stub_kind) { |
| 421 case KeyedIC::LOAD: { | 420 case KeyedIC::LOAD: { |
| 422 KeyedLoadStubCompiler compiler(isolate_); | 421 KeyedLoadStubCompiler compiler(isolate_); |
| 423 code = compiler.CompileLoadElement(receiver_map); | 422 code = compiler.CompileLoadElement(receiver_map); |
| 424 break; | 423 break; |
| 425 } | 424 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 440 break; | 439 break; |
| 441 } | 440 } |
| 442 | 441 |
| 443 ASSERT(!code.is_null()); | 442 ASSERT(!code.is_null()); |
| 444 | 443 |
| 445 if (stub_kind == KeyedIC::LOAD) { | 444 if (stub_kind == KeyedIC::LOAD) { |
| 446 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); | 445 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); |
| 447 } else { | 446 } else { |
| 448 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, 0)); | 447 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, 0)); |
| 449 } | 448 } |
| 450 JSObject::UpdateMapCodeCache(receiver, name, code); | 449 Map::UpdateCodeCache(receiver_map, name, code); |
| 451 return code; | 450 return code; |
| 452 } | 451 } |
| 453 | 452 |
| 454 | 453 |
| 455 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { | 454 Handle<Code> StubCache::ComputeStoreNormal(StrictModeFlag strict_mode) { |
| 456 return (strict_mode == kStrictMode) | 455 return (strict_mode == kStrictMode) |
| 457 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() | 456 ? isolate_->builtins()->Builtins::StoreIC_Normal_Strict() |
| 458 : isolate_->builtins()->Builtins::StoreIC_Normal(); | 457 : isolate_->builtins()->Builtins::StoreIC_Normal(); |
| 459 } | 458 } |
| 460 | 459 |
| (...skipping 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1525 Handle<FunctionTemplateInfo>( | 1524 Handle<FunctionTemplateInfo>( |
| 1526 FunctionTemplateInfo::cast(signature->receiver())); | 1525 FunctionTemplateInfo::cast(signature->receiver())); |
| 1527 } | 1526 } |
| 1528 } | 1527 } |
| 1529 | 1528 |
| 1530 is_simple_api_call_ = true; | 1529 is_simple_api_call_ = true; |
| 1531 } | 1530 } |
| 1532 | 1531 |
| 1533 | 1532 |
| 1534 } } // namespace v8::internal | 1533 } } // namespace v8::internal |
| OLD | NEW |