| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/bailout-reason.h" | 7 #include "src/bailout-reason.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/field-index.h" | 9 #include "src/field-index.h" |
| 10 #include "src/hydrogen.h" | 10 #include "src/hydrogen.h" |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 } | 443 } |
| 444 | 444 |
| 445 | 445 |
| 446 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { | 446 Handle<Code> FastCloneShallowObjectStub::GenerateCode() { |
| 447 return DoGenerateCode(this); | 447 return DoGenerateCode(this); |
| 448 } | 448 } |
| 449 | 449 |
| 450 | 450 |
| 451 template <> | 451 template <> |
| 452 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | 452 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { |
| 453 // This stub is performance sensitive, the generated code must be tuned | |
| 454 // so that it doesn't build an eager frame. | |
| 455 info()->MarkMustNotHaveEagerFrame(); | |
| 456 | |
| 457 HValue* size = Add<HConstant>(AllocationSite::kSize); | 453 HValue* size = Add<HConstant>(AllocationSite::kSize); |
| 458 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, | 454 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, |
| 459 JS_OBJECT_TYPE); | 455 JS_OBJECT_TYPE); |
| 460 | 456 |
| 461 // Store the map | 457 // Store the map |
| 462 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); | 458 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); |
| 463 AddStoreMapConstant(object, allocation_site_map); | 459 AddStoreMapConstant(object, allocation_site_map); |
| 464 | 460 |
| 465 // Store the payload (smi elements kind) | 461 // Store the payload (smi elements kind) |
| 466 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | 462 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 return feedback_vector; | 516 return feedback_vector; |
| 521 } | 517 } |
| 522 | 518 |
| 523 | 519 |
| 524 Handle<Code> CreateAllocationSiteStub::GenerateCode() { | 520 Handle<Code> CreateAllocationSiteStub::GenerateCode() { |
| 525 return DoGenerateCode(this); | 521 return DoGenerateCode(this); |
| 526 } | 522 } |
| 527 | 523 |
| 528 | 524 |
| 529 template <> | 525 template <> |
| 530 HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() { | |
| 531 // This stub is performance sensitive, the generated code must be tuned | |
| 532 // so that it doesn't build an eager frame. | |
| 533 info()->MarkMustNotHaveEagerFrame(); | |
| 534 | |
| 535 HValue* size = Add<HConstant>(WeakCell::kSize); | |
| 536 HInstruction* object = | |
| 537 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE); | |
| 538 | |
| 539 Handle<Map> weak_cell_map = isolate()->factory()->weak_cell_map(); | |
| 540 AddStoreMapConstant(object, weak_cell_map); | |
| 541 | |
| 542 HInstruction* value = GetParameter(CreateWeakCellDescriptor::kValueIndex); | |
| 543 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellValue(), value); | |
| 544 Add<HStoreNamedField>(object, HObjectAccess::ForWeakCellNext(), | |
| 545 graph()->GetConstantUndefined()); | |
| 546 | |
| 547 HInstruction* feedback_vector = | |
| 548 GetParameter(CreateWeakCellDescriptor::kVectorIndex); | |
| 549 HInstruction* slot = GetParameter(CreateWeakCellDescriptor::kSlotIndex); | |
| 550 Add<HStoreKeyed>(feedback_vector, slot, object, FAST_ELEMENTS, | |
| 551 INITIALIZING_STORE); | |
| 552 return graph()->GetConstant0(); | |
| 553 } | |
| 554 | |
| 555 | |
| 556 Handle<Code> CreateWeakCellStub::GenerateCode() { return DoGenerateCode(this); } | |
| 557 | |
| 558 | |
| 559 template <> | |
| 560 HValue* CodeStubGraphBuilder<LoadScriptContextFieldStub>::BuildCodeStub() { | 526 HValue* CodeStubGraphBuilder<LoadScriptContextFieldStub>::BuildCodeStub() { |
| 561 int context_index = casted_stub()->context_index(); | 527 int context_index = casted_stub()->context_index(); |
| 562 int slot_index = casted_stub()->slot_index(); | 528 int slot_index = casted_stub()->slot_index(); |
| 563 | 529 |
| 564 HValue* script_context = BuildGetScriptContext(context_index); | 530 HValue* script_context = BuildGetScriptContext(context_index); |
| 565 return Add<HLoadNamedField>(script_context, nullptr, | 531 return Add<HLoadNamedField>(script_context, nullptr, |
| 566 HObjectAccess::ForContextSlot(slot_index)); | 532 HObjectAccess::ForContextSlot(slot_index)); |
| 567 } | 533 } |
| 568 | 534 |
| 569 | 535 |
| (...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2246 // megamorphic case is handled as part of the default stub. | 2212 // megamorphic case is handled as part of the default stub. |
| 2247 DCHECK(!FLAG_vector_ics); | 2213 DCHECK(!FLAG_vector_ics); |
| 2248 | 2214 |
| 2249 // Probe the stub cache. | 2215 // Probe the stub cache. |
| 2250 Add<HTailCallThroughMegamorphicCache>(receiver, name); | 2216 Add<HTailCallThroughMegamorphicCache>(receiver, name); |
| 2251 | 2217 |
| 2252 // We never continue. | 2218 // We never continue. |
| 2253 return graph()->GetConstant0(); | 2219 return graph()->GetConstant0(); |
| 2254 } | 2220 } |
| 2255 } } // namespace v8::internal | 2221 } } // namespace v8::internal |
| OLD | NEW |