OLD | NEW |
1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 390 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
391 JSObject::UpdateMapCodeCache(receiver, name, code); | 391 JSObject::UpdateMapCodeCache(receiver, name, code); |
392 return code; | 392 return code; |
393 } | 393 } |
394 | 394 |
395 | 395 |
396 Handle<Code> StubCache::ComputeKeyedLoadOrStoreElement( | 396 Handle<Code> StubCache::ComputeKeyedLoadOrStoreElement( |
397 Handle<JSObject> receiver, | 397 Handle<JSObject> receiver, |
398 KeyedIC::StubKind stub_kind, | 398 KeyedIC::StubKind stub_kind, |
399 StrictModeFlag strict_mode) { | 399 StrictModeFlag strict_mode) { |
| 400 KeyedAccessGrowMode grow_mode = |
| 401 KeyedIC::GetGrowModeFromStubKind(stub_kind); |
| 402 Code::ExtraICState extra_state = |
| 403 Code::ComputeExtraICState(grow_mode, strict_mode); |
400 Code::Flags flags = | 404 Code::Flags flags = |
401 Code::ComputeMonomorphicFlags( | 405 Code::ComputeMonomorphicFlags( |
402 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC | 406 stub_kind == KeyedIC::LOAD ? Code::KEYED_LOAD_IC |
403 : Code::KEYED_STORE_IC, | 407 : Code::KEYED_STORE_IC, |
404 NORMAL, | 408 NORMAL, |
405 strict_mode); | 409 extra_state); |
406 Handle<String> name; | 410 Handle<String> name; |
407 switch (stub_kind) { | 411 switch (stub_kind) { |
408 case KeyedIC::LOAD: | 412 case KeyedIC::LOAD: |
409 name = isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); | 413 name = isolate()->factory()->KeyedLoadElementMonomorphic_symbol(); |
410 break; | 414 break; |
411 case KeyedIC::STORE_NO_TRANSITION: | 415 case KeyedIC::STORE_NO_TRANSITION: |
412 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); | 416 name = isolate()->factory()->KeyedStoreElementMonomorphic_symbol(); |
413 break; | 417 break; |
| 418 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: |
| 419 name = isolate()->factory()->KeyedStoreAndGrowElementMonomorphic_symbol(); |
| 420 break; |
414 default: | 421 default: |
415 UNREACHABLE(); | 422 UNREACHABLE(); |
416 break; | 423 break; |
417 } | 424 } |
418 Handle<Map> receiver_map(receiver->map()); | 425 Handle<Map> receiver_map(receiver->map()); |
419 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags)); | 426 Handle<Object> probe(receiver_map->FindInCodeCache(*name, flags)); |
420 if (probe->IsCode()) return Handle<Code>::cast(probe); | 427 if (probe->IsCode()) return Handle<Code>::cast(probe); |
421 | 428 |
422 Handle<Code> code; | 429 Handle<Code> code; |
423 switch (stub_kind) { | 430 switch (stub_kind) { |
424 case KeyedIC::LOAD: { | 431 case KeyedIC::LOAD: { |
425 KeyedLoadStubCompiler compiler(isolate_); | 432 KeyedLoadStubCompiler compiler(isolate_); |
426 code = compiler.CompileLoadElement(receiver_map); | 433 code = compiler.CompileLoadElement(receiver_map); |
427 break; | 434 break; |
428 } | 435 } |
429 case KeyedIC::STORE_NO_TRANSITION: { | 436 case KeyedIC::STORE_AND_GROW_NO_TRANSITION: { |
430 KeyedStoreStubCompiler compiler(isolate_, strict_mode); | 437 KeyedStoreStubCompiler compiler(isolate_, strict_mode, |
| 438 ALLOW_JSARRAY_GROWTH); |
431 code = compiler.CompileStoreElement(receiver_map); | 439 code = compiler.CompileStoreElement(receiver_map); |
432 break; | 440 break; |
433 } | 441 } |
| 442 case KeyedIC::STORE_NO_TRANSITION: { |
| 443 KeyedStoreStubCompiler compiler(isolate_, strict_mode, |
| 444 DO_NOT_ALLOW_JSARRAY_GROWTH); |
| 445 code = compiler.CompileStoreElement(receiver_map); |
| 446 break; |
| 447 } |
434 default: | 448 default: |
435 UNREACHABLE(); | 449 UNREACHABLE(); |
436 break; | 450 break; |
437 } | 451 } |
438 | 452 |
439 ASSERT(!code.is_null()); | 453 ASSERT(!code.is_null()); |
440 | 454 |
441 if (stub_kind == KeyedIC::LOAD) { | 455 if (stub_kind == KeyedIC::LOAD) { |
442 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); | 456 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_LOAD_IC_TAG, *code, 0)); |
443 } else { | 457 } else { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 Handle<JSObject> receiver, | 526 Handle<JSObject> receiver, |
513 int field_index, | 527 int field_index, |
514 Handle<Map> transition, | 528 Handle<Map> transition, |
515 StrictModeFlag strict_mode) { | 529 StrictModeFlag strict_mode) { |
516 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION; | 530 PropertyType type = (transition.is_null()) ? FIELD : MAP_TRANSITION; |
517 Code::Flags flags = Code::ComputeMonomorphicFlags( | 531 Code::Flags flags = Code::ComputeMonomorphicFlags( |
518 Code::KEYED_STORE_IC, type, strict_mode); | 532 Code::KEYED_STORE_IC, type, strict_mode); |
519 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); | 533 Handle<Object> probe(receiver->map()->FindInCodeCache(*name, flags)); |
520 if (probe->IsCode()) return Handle<Code>::cast(probe); | 534 if (probe->IsCode()) return Handle<Code>::cast(probe); |
521 | 535 |
522 KeyedStoreStubCompiler compiler(isolate(), strict_mode); | 536 KeyedStoreStubCompiler compiler(isolate(), strict_mode, |
| 537 DO_NOT_ALLOW_JSARRAY_GROWTH); |
523 Handle<Code> code = | 538 Handle<Code> code = |
524 compiler.CompileStoreField(receiver, field_index, transition, name); | 539 compiler.CompileStoreField(receiver, field_index, transition, name); |
525 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); | 540 PROFILE(isolate_, CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); |
526 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); | 541 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
527 JSObject::UpdateMapCodeCache(receiver, name, code); | 542 JSObject::UpdateMapCodeCache(receiver, name, code); |
528 return code; | 543 return code; |
529 } | 544 } |
530 | 545 |
531 | 546 |
532 #define CALL_LOGGER_TAG(kind, type) \ | 547 #define CALL_LOGGER_TAG(kind, type) \ |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1342 Handle<Code> code = GetCodeWithFlags(flags, name); | 1357 Handle<Code> code = GetCodeWithFlags(flags, name); |
1343 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); | 1358 PROFILE(isolate(), CodeCreateEvent(Logger::STORE_IC_TAG, *code, *name)); |
1344 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); | 1359 GDBJIT(AddCode(GDBJITInterface::STORE_IC, *name, *code)); |
1345 return code; | 1360 return code; |
1346 } | 1361 } |
1347 | 1362 |
1348 | 1363 |
1349 Handle<Code> KeyedStoreStubCompiler::GetCode(PropertyType type, | 1364 Handle<Code> KeyedStoreStubCompiler::GetCode(PropertyType type, |
1350 Handle<String> name, | 1365 Handle<String> name, |
1351 InlineCacheState state) { | 1366 InlineCacheState state) { |
| 1367 Code::ExtraICState extra_state = |
| 1368 Code::ComputeExtraICState(grow_mode_, strict_mode_); |
1352 Code::Flags flags = | 1369 Code::Flags flags = |
1353 Code::ComputeFlags(Code::KEYED_STORE_IC, state, strict_mode_, type); | 1370 Code::ComputeFlags(Code::KEYED_STORE_IC, state, extra_state, type); |
1354 Handle<Code> code = GetCodeWithFlags(flags, name); | 1371 Handle<Code> code = GetCodeWithFlags(flags, name); |
1355 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); | 1372 PROFILE(isolate(), CodeCreateEvent(Logger::KEYED_STORE_IC_TAG, *code, *name)); |
1356 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); | 1373 GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, *name, *code)); |
1357 return code; | 1374 return code; |
1358 } | 1375 } |
1359 | 1376 |
1360 | 1377 |
1361 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( | 1378 void KeyedStoreStubCompiler::GenerateStoreDictionaryElement( |
1362 MacroAssembler* masm) { | 1379 MacroAssembler* masm) { |
1363 KeyedStoreIC::GenerateSlow(masm); | 1380 KeyedStoreIC::GenerateSlow(masm); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1516 Handle<FunctionTemplateInfo>( | 1533 Handle<FunctionTemplateInfo>( |
1517 FunctionTemplateInfo::cast(signature->receiver())); | 1534 FunctionTemplateInfo::cast(signature->receiver())); |
1518 } | 1535 } |
1519 } | 1536 } |
1520 | 1537 |
1521 is_simple_api_call_ = true; | 1538 is_simple_api_call_ = true; |
1522 } | 1539 } |
1523 | 1540 |
1524 | 1541 |
1525 } } // namespace v8::internal | 1542 } } // namespace v8::internal |
OLD | NEW |