Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: src/hydrogen.cc

Issue 148523011: Add dependency operand to HLoadNamedField. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix HLoadNamedField::PrintDataTo(). Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 current_block()->FinishExit(instruction, position_); 1187 current_block()->FinishExit(instruction, position_);
1188 if (instruction->IsReturn() || instruction->IsAbnormalExit()) { 1188 if (instruction->IsReturn() || instruction->IsAbnormalExit()) {
1189 set_current_block(NULL); 1189 set_current_block(NULL);
1190 } 1190 }
1191 } 1191 }
1192 1192
1193 1193
1194 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter) { 1194 void HGraphBuilder::AddIncrementCounter(StatsCounter* counter) {
1195 if (FLAG_native_code_counters && counter->Enabled()) { 1195 if (FLAG_native_code_counters && counter->Enabled()) {
1196 HValue* reference = Add<HConstant>(ExternalReference(counter)); 1196 HValue* reference = Add<HConstant>(ExternalReference(counter));
1197 HValue* old_value = Add<HLoadNamedField>(reference, 1197 HValue* old_value = Add<HLoadNamedField>(
1198 HObjectAccess::ForCounter()); 1198 reference, static_cast<HValue*>(NULL), HObjectAccess::ForCounter());
1199 HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1()); 1199 HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1());
1200 new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow 1200 new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
1201 Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(), 1201 Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(),
1202 new_value, STORE_TO_INITIALIZED_ENTRY); 1202 new_value, STORE_TO_INITIALIZED_ENTRY);
1203 } 1203 }
1204 } 1204 }
1205 1205
1206 1206
1207 void HGraphBuilder::AddSimulate(BailoutId id, 1207 void HGraphBuilder::AddSimulate(BailoutId id,
1208 RemovableSimulate removable) { 1208 RemovableSimulate removable) {
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 1406
1407 IfBuilder if_builder(this); 1407 IfBuilder if_builder(this);
1408 1408
1409 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array); 1409 if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array);
1410 1410
1411 if_builder.Then(); 1411 if_builder.Then();
1412 1412
1413 HInstruction* elements_length = AddLoadFixedArrayLength(elements); 1413 HInstruction* elements_length = AddLoadFixedArrayLength(elements);
1414 1414
1415 HInstruction* array_length = is_jsarray 1415 HInstruction* array_length = is_jsarray
1416 ? Add<HLoadNamedField>(object, HObjectAccess::ForArrayLength(from_kind)) 1416 ? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
1417 HObjectAccess::ForArrayLength(from_kind))
1417 : elements_length; 1418 : elements_length;
1418 1419
1419 BuildGrowElementsCapacity(object, elements, from_kind, to_kind, 1420 BuildGrowElementsCapacity(object, elements, from_kind, to_kind,
1420 array_length, elements_length); 1421 array_length, elements_length);
1421 1422
1422 if_builder.End(); 1423 if_builder.End();
1423 } 1424 }
1424 1425
1425 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), map, 1426 Add<HStoreNamedField>(object, HObjectAccess::ForMap(), map,
1426 INITIALIZING_STORE); 1427 INITIALIZING_STORE);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1608 } 1609 }
1609 if_objectiskey.JoinContinuation(&found); 1610 if_objectiskey.JoinContinuation(&found);
1610 } 1611 }
1611 if_objectissmi.Else(); 1612 if_objectissmi.Else();
1612 { 1613 {
1613 if (type->Is(Type::Smi())) { 1614 if (type->Is(Type::Smi())) {
1614 if_objectissmi.Deopt("Expected smi"); 1615 if_objectissmi.Deopt("Expected smi");
1615 } else { 1616 } else {
1616 // Check if the object is a heap number. 1617 // Check if the object is a heap number.
1617 IfBuilder if_objectisnumber(this); 1618 IfBuilder if_objectisnumber(this);
1618 if_objectisnumber.If<HCompareMap>( 1619 HValue* objectisnumber = if_objectisnumber.If<HCompareMap>(
1619 object, isolate()->factory()->heap_number_map()); 1620 object, isolate()->factory()->heap_number_map());
1620 if_objectisnumber.Then(); 1621 if_objectisnumber.Then();
1621 { 1622 {
1622 // Compute hash for heap number similar to double_get_hash(). 1623 // Compute hash for heap number similar to double_get_hash().
1623 HValue* low = Add<HLoadNamedField>( 1624 HValue* low = Add<HLoadNamedField>(
1624 object, HObjectAccess::ForHeapNumberValueLowestBits()); 1625 object, objectisnumber,
1626 HObjectAccess::ForHeapNumberValueLowestBits());
1625 HValue* high = Add<HLoadNamedField>( 1627 HValue* high = Add<HLoadNamedField>(
1626 object, HObjectAccess::ForHeapNumberValueHighestBits()); 1628 object, objectisnumber,
1629 HObjectAccess::ForHeapNumberValueHighestBits());
1627 HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, low, high); 1630 HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, low, high);
1628 hash = AddUncasted<HBitwise>(Token::BIT_AND, hash, mask); 1631 hash = AddUncasted<HBitwise>(Token::BIT_AND, hash, mask);
1629 1632
1630 // Load the key. 1633 // Load the key.
1631 HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1()); 1634 HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1());
1632 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index, 1635 HValue* key = Add<HLoadKeyed>(number_string_cache, key_index,
1633 static_cast<HValue*>(NULL), 1636 static_cast<HValue*>(NULL),
1634 FAST_ELEMENTS, ALLOW_RETURN_HOLE); 1637 FAST_ELEMENTS, ALLOW_RETURN_HOLE);
1635 1638
1636 // Check if key is a heap number (the number string cache contains only 1639 // Check if key is a heap number (the number string cache contains only
1637 // SMIs and heap number, so it is sufficient to do a SMI check here). 1640 // SMIs and heap number, so it is sufficient to do a SMI check here).
1638 IfBuilder if_keyisnotsmi(this); 1641 IfBuilder if_keyisnotsmi(this);
1639 if_keyisnotsmi.IfNot<HIsSmiAndBranch>(key); 1642 HValue* keyisnotsmi = if_keyisnotsmi.IfNot<HIsSmiAndBranch>(key);
1640 if_keyisnotsmi.Then(); 1643 if_keyisnotsmi.Then();
1641 { 1644 {
1642 // Check if values of key and object match. 1645 // Check if values of key and object match.
1643 IfBuilder if_keyeqobject(this); 1646 IfBuilder if_keyeqobject(this);
1644 if_keyeqobject.If<HCompareNumericAndBranch>( 1647 if_keyeqobject.If<HCompareNumericAndBranch>(
1645 Add<HLoadNamedField>(key, HObjectAccess::ForHeapNumberValue()), 1648 Add<HLoadNamedField>(key, keyisnotsmi,
1646 Add<HLoadNamedField>(object, HObjectAccess::ForHeapNumberValue()), 1649 HObjectAccess::ForHeapNumberValue()),
1650 Add<HLoadNamedField>(object, objectisnumber,
1651 HObjectAccess::ForHeapNumberValue()),
1647 Token::EQ); 1652 Token::EQ);
1648 if_keyeqobject.Then(); 1653 if_keyeqobject.Then();
1649 { 1654 {
1650 // Make the key_index available. 1655 // Make the key_index available.
1651 Push(key_index); 1656 Push(key_index);
1652 } 1657 }
1653 if_keyeqobject.JoinContinuation(&found); 1658 if_keyeqobject.JoinContinuation(&found);
1654 } 1659 }
1655 if_keyisnotsmi.JoinContinuation(&found); 1660 if_keyisnotsmi.JoinContinuation(&found);
1656 } 1661 }
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2104 HValue* elements = AddLoadElements(checked_object); 2109 HValue* elements = AddLoadElements(checked_object);
2105 if (is_store && (fast_elements || fast_smi_only_elements) && 2110 if (is_store && (fast_elements || fast_smi_only_elements) &&
2106 store_mode != STORE_NO_TRANSITION_HANDLE_COW) { 2111 store_mode != STORE_NO_TRANSITION_HANDLE_COW) {
2107 HCheckMaps* check_cow_map = Add<HCheckMaps>( 2112 HCheckMaps* check_cow_map = Add<HCheckMaps>(
2108 elements, isolate()->factory()->fixed_array_map(), top_info()); 2113 elements, isolate()->factory()->fixed_array_map(), top_info());
2109 check_cow_map->ClearGVNFlag(kDependsOnElementsKind); 2114 check_cow_map->ClearGVNFlag(kDependsOnElementsKind);
2110 } 2115 }
2111 HInstruction* length = NULL; 2116 HInstruction* length = NULL;
2112 if (is_js_array) { 2117 if (is_js_array) {
2113 length = Add<HLoadNamedField>( 2118 length = Add<HLoadNamedField>(
2114 checked_object, HObjectAccess::ForArrayLength(elements_kind)); 2119 checked_object, static_cast<HValue*>(NULL),
2120 HObjectAccess::ForArrayLength(elements_kind));
2115 } else { 2121 } else {
2116 length = AddLoadFixedArrayLength(elements); 2122 length = AddLoadFixedArrayLength(elements);
2117 } 2123 }
2118 length->set_type(HType::Smi()); 2124 length->set_type(HType::Smi());
2119 HValue* checked_key = NULL; 2125 HValue* checked_key = NULL;
2120 if (IsExternalArrayElementsKind(elements_kind) || 2126 if (IsExternalArrayElementsKind(elements_kind) ||
2121 IsFixedTypedArrayElementsKind(elements_kind)) { 2127 IsFixedTypedArrayElementsKind(elements_kind)) {
2122 HValue* backing_store; 2128 HValue* backing_store;
2123 if (IsExternalArrayElementsKind(elements_kind)) { 2129 if (IsExternalArrayElementsKind(elements_kind)) {
2124 backing_store = Add<HLoadNamedField>( 2130 backing_store = Add<HLoadNamedField>(
2125 elements, HObjectAccess::ForExternalArrayExternalPointer()); 2131 elements, static_cast<HValue*>(NULL),
2132 HObjectAccess::ForExternalArrayExternalPointer());
2126 } else { 2133 } else {
2127 backing_store = elements; 2134 backing_store = elements;
2128 } 2135 }
2129 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) { 2136 if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
2130 NoObservableSideEffectsScope no_effects(this); 2137 NoObservableSideEffectsScope no_effects(this);
2131 IfBuilder length_checker(this); 2138 IfBuilder length_checker(this);
2132 length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT); 2139 length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT);
2133 length_checker.Then(); 2140 length_checker.Then();
2134 IfBuilder negative_checker(this); 2141 IfBuilder negative_checker(this);
2135 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>( 2142 HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
2348 if (FLAG_opt_safe_uint32_operations && 2355 if (FLAG_opt_safe_uint32_operations &&
2349 (elements_kind == EXTERNAL_UINT32_ELEMENTS || 2356 (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
2350 elements_kind == UINT32_ELEMENTS)) { 2357 elements_kind == UINT32_ELEMENTS)) {
2351 graph()->RecordUint32Instruction(load); 2358 graph()->RecordUint32Instruction(load);
2352 } 2359 }
2353 return load; 2360 return load;
2354 } 2361 }
2355 2362
2356 2363
2357 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object) { 2364 HLoadNamedField* HGraphBuilder::AddLoadElements(HValue* object) {
2358 return Add<HLoadNamedField>(object, HObjectAccess::ForElementsPointer()); 2365 return Add<HLoadNamedField>(
2366 object, static_cast<HValue*>(NULL), HObjectAccess::ForElementsPointer());
2359 } 2367 }
2360 2368
2361 2369
2362 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) { 2370 HLoadNamedField* HGraphBuilder::AddLoadFixedArrayLength(HValue* object) {
2363 return Add<HLoadNamedField>(object, 2371 return Add<HLoadNamedField>(
2364 HObjectAccess::ForFixedArrayLength()); 2372 object, static_cast<HValue*>(NULL), HObjectAccess::ForFixedArrayLength());
2365 } 2373 }
2366 2374
2367 2375
2368 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) { 2376 HValue* HGraphBuilder::BuildNewElementsCapacity(HValue* old_capacity) {
2369 HValue* half_old_capacity = AddUncasted<HShr>(old_capacity, 2377 HValue* half_old_capacity = AddUncasted<HShr>(old_capacity,
2370 graph_->GetConstant1()); 2378 graph_->GetConstant1());
2371 2379
2372 HValue* new_capacity = AddUncasted<HAdd>(half_old_capacity, old_capacity); 2380 HValue* new_capacity = AddUncasted<HAdd>(half_old_capacity, old_capacity);
2373 new_capacity->ClearFlag(HValue::kCanOverflow); 2381 new_capacity->ClearFlag(HValue::kCanOverflow);
2374 2382
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 HValue* size_in_bytes = Add<HConstant>(size); 2549 HValue* size_in_bytes = Add<HConstant>(size);
2542 HInstruction* object = Add<HAllocate>(size_in_bytes, 2550 HInstruction* object = Add<HAllocate>(size_in_bytes,
2543 HType::JSObject(), 2551 HType::JSObject(),
2544 NOT_TENURED, 2552 NOT_TENURED,
2545 JS_OBJECT_TYPE); 2553 JS_OBJECT_TYPE);
2546 2554
2547 // Copy the JS array part. 2555 // Copy the JS array part.
2548 for (int i = 0; i < JSArray::kSize; i += kPointerSize) { 2556 for (int i = 0; i < JSArray::kSize; i += kPointerSize) {
2549 if ((i != JSArray::kElementsOffset) || (length == 0)) { 2557 if ((i != JSArray::kElementsOffset) || (length == 0)) {
2550 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i); 2558 HObjectAccess access = HObjectAccess::ForJSArrayOffset(i);
2551 Add<HStoreNamedField>(object, access, 2559 Add<HStoreNamedField>(
2552 Add<HLoadNamedField>(boilerplate, access), 2560 object, access, Add<HLoadNamedField>(
2553 INITIALIZING_STORE); 2561 boilerplate, static_cast<HValue*>(NULL), access),
2562 INITIALIZING_STORE);
2554 } 2563 }
2555 } 2564 }
2556 2565
2557 // Create an allocation site info if requested. 2566 // Create an allocation site info if requested.
2558 if (mode == TRACK_ALLOCATION_SITE) { 2567 if (mode == TRACK_ALLOCATION_SITE) {
2559 BuildCreateAllocationMemento( 2568 BuildCreateAllocationMemento(
2560 object, Add<HConstant>(JSArray::kSize), allocation_site); 2569 object, Add<HConstant>(JSArray::kSize), allocation_site);
2561 } 2570 }
2562 2571
2563 if (length > 0) { 2572 if (length > 0) {
2564 HValue* boilerplate_elements = AddLoadElements(boilerplate); 2573 HValue* boilerplate_elements = AddLoadElements(boilerplate);
2565 HValue* object_elements; 2574 HValue* object_elements;
2566 if (IsFastDoubleElementsKind(kind)) { 2575 if (IsFastDoubleElementsKind(kind)) {
2567 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length)); 2576 HValue* elems_size = Add<HConstant>(FixedDoubleArray::SizeFor(length));
2568 object_elements = Add<HAllocate>(elems_size, HType::JSArray(), 2577 object_elements = Add<HAllocate>(elems_size, HType::JSArray(),
2569 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE); 2578 NOT_TENURED, FIXED_DOUBLE_ARRAY_TYPE);
2570 } else { 2579 } else {
2571 HValue* elems_size = Add<HConstant>(FixedArray::SizeFor(length)); 2580 HValue* elems_size = Add<HConstant>(FixedArray::SizeFor(length));
2572 object_elements = Add<HAllocate>(elems_size, HType::JSArray(), 2581 object_elements = Add<HAllocate>(elems_size, HType::JSArray(),
2573 NOT_TENURED, FIXED_ARRAY_TYPE); 2582 NOT_TENURED, FIXED_ARRAY_TYPE);
2574 } 2583 }
2575 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(), 2584 Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
2576 object_elements, INITIALIZING_STORE); 2585 object_elements, INITIALIZING_STORE);
2577 2586
2578 // Copy the elements array header. 2587 // Copy the elements array header.
2579 for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) { 2588 for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) {
2580 HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i); 2589 HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i);
2581 Add<HStoreNamedField>(object_elements, access, 2590 Add<HStoreNamedField>(
2582 Add<HLoadNamedField>(boilerplate_elements, access), 2591 object_elements, access, Add<HLoadNamedField>(
2583 INITIALIZING_STORE); 2592 boilerplate_elements, static_cast<HValue*>(NULL), access),
2593 INITIALIZING_STORE);
2584 } 2594 }
2585 2595
2586 // Copy the elements array contents. 2596 // Copy the elements array contents.
2587 // TODO(mstarzinger): Teach HGraphBuilder::BuildCopyElements to unfold 2597 // TODO(mstarzinger): Teach HGraphBuilder::BuildCopyElements to unfold
2588 // copying loops with constant length up to a given boundary and use this 2598 // copying loops with constant length up to a given boundary and use this
2589 // helper here instead. 2599 // helper here instead.
2590 for (int i = 0; i < length; i++) { 2600 for (int i = 0; i < length; i++) {
2591 HValue* key_constant = Add<HConstant>(i); 2601 HValue* key_constant = Add<HConstant>(i);
2592 HInstruction* value = Add<HLoadKeyed>(boilerplate_elements, key_constant, 2602 HInstruction* value = Add<HLoadKeyed>(boilerplate_elements, key_constant,
2593 static_cast<HValue*>(NULL), kind); 2603 static_cast<HValue*>(NULL), kind);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
2659 ASSERT(allocation_site != NULL); 2669 ASSERT(allocation_site != NULL);
2660 HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>( 2670 HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>(
2661 previous_object, previous_object_size); 2671 previous_object, previous_object_size);
2662 AddStoreMapConstant( 2672 AddStoreMapConstant(
2663 allocation_memento, isolate()->factory()->allocation_memento_map()); 2673 allocation_memento, isolate()->factory()->allocation_memento_map());
2664 Add<HStoreNamedField>( 2674 Add<HStoreNamedField>(
2665 allocation_memento, HObjectAccess::ForAllocationMementoSite(), 2675 allocation_memento, HObjectAccess::ForAllocationMementoSite(),
2666 allocation_site, INITIALIZING_STORE); 2676 allocation_site, INITIALIZING_STORE);
2667 if (FLAG_allocation_site_pretenuring) { 2677 if (FLAG_allocation_site_pretenuring) {
2668 HValue* memento_create_count = Add<HLoadNamedField>( 2678 HValue* memento_create_count = Add<HLoadNamedField>(
2669 allocation_site, HObjectAccess::ForAllocationSiteOffset( 2679 allocation_site, static_cast<HValue*>(NULL),
2680 HObjectAccess::ForAllocationSiteOffset(
2670 AllocationSite::kPretenureCreateCountOffset)); 2681 AllocationSite::kPretenureCreateCountOffset));
2671 memento_create_count = AddUncasted<HAdd>( 2682 memento_create_count = AddUncasted<HAdd>(
2672 memento_create_count, graph()->GetConstant1()); 2683 memento_create_count, graph()->GetConstant1());
2673 // This smi value is reset to zero after every gc, overflow isn't a problem 2684 // This smi value is reset to zero after every gc, overflow isn't a problem
2674 // since the counter is bounded by the new space size. 2685 // since the counter is bounded by the new space size.
2675 memento_create_count->ClearFlag(HValue::kCanOverflow); 2686 memento_create_count->ClearFlag(HValue::kCanOverflow);
2676 HStoreNamedField* store = Add<HStoreNamedField>( 2687 HStoreNamedField* store = Add<HStoreNamedField>(
2677 allocation_site, HObjectAccess::ForAllocationSiteOffset( 2688 allocation_site, HObjectAccess::ForAllocationSiteOffset(
2678 AllocationSite::kPretenureCreateCountOffset), memento_create_count, 2689 AllocationSite::kPretenureCreateCountOffset), memento_create_count,
2679 INITIALIZING_STORE); 2690 INITIALIZING_STORE);
2680 // No write barrier needed to store a smi. 2691 // No write barrier needed to store a smi.
2681 store->SkipWriteBarrier(); 2692 store->SkipWriteBarrier();
2682 } 2693 }
2683 } 2694 }
2684 2695
2685 2696
2686 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) { 2697 HInstruction* HGraphBuilder::BuildGetNativeContext(HValue* closure) {
2687 // Get the global context, then the native context 2698 // Get the global context, then the native context
2688 HInstruction* context = 2699 HInstruction* context =
2689 Add<HLoadNamedField>(closure, HObjectAccess::ForFunctionContextPointer()); 2700 Add<HLoadNamedField>(closure, static_cast<HValue*>(NULL),
2690 HInstruction* global_object = Add<HLoadNamedField>(context, 2701 HObjectAccess::ForFunctionContextPointer());
2702 HInstruction* global_object = Add<HLoadNamedField>(
2703 context, static_cast<HValue*>(NULL),
2691 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 2704 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
2692 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 2705 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
2693 GlobalObject::kNativeContextOffset); 2706 GlobalObject::kNativeContextOffset);
2694 return Add<HLoadNamedField>(global_object, access); 2707 return Add<HLoadNamedField>(
2708 global_object, static_cast<HValue*>(NULL), access);
2695 } 2709 }
2696 2710
2697 2711
2698 HInstruction* HGraphBuilder::BuildGetNativeContext() { 2712 HInstruction* HGraphBuilder::BuildGetNativeContext() {
2699 // Get the global context, then the native context 2713 // Get the global context, then the native context
2700 HValue* global_object = Add<HLoadNamedField>( 2714 HValue* global_object = Add<HLoadNamedField>(
2701 context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 2715 context(), static_cast<HValue*>(NULL),
2716 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
2702 return Add<HLoadNamedField>( 2717 return Add<HLoadNamedField>(
2703 global_object, HObjectAccess::ForJSObjectOffset( 2718 global_object, static_cast<HValue*>(NULL),
2704 GlobalObject::kNativeContextOffset)); 2719 HObjectAccess::ForJSObjectOffset(GlobalObject::kNativeContextOffset));
2705 } 2720 }
2706 2721
2707 2722
2708 HInstruction* HGraphBuilder::BuildGetArrayFunction() { 2723 HInstruction* HGraphBuilder::BuildGetArrayFunction() {
2709 HInstruction* native_context = BuildGetNativeContext(); 2724 HInstruction* native_context = BuildGetNativeContext();
2710 HInstruction* index = 2725 HInstruction* index =
2711 Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX)); 2726 Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX));
2712 return Add<HLoadKeyed>( 2727 return Add<HLoadKeyed>(
2713 native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS); 2728 native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS);
2714 } 2729 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2891 2906
2892 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object, 2907 HStoreNamedField* HGraphBuilder::AddStoreMapConstant(HValue *object,
2893 Handle<Map> map) { 2908 Handle<Map> map) {
2894 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(), 2909 return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
2895 Add<HConstant>(map), INITIALIZING_STORE); 2910 Add<HConstant>(map), INITIALIZING_STORE);
2896 } 2911 }
2897 2912
2898 2913
2899 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) { 2914 HValue* HGraphBuilder::AddLoadJSBuiltin(Builtins::JavaScript builtin) {
2900 HValue* global_object = Add<HLoadNamedField>( 2915 HValue* global_object = Add<HLoadNamedField>(
2901 context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 2916 context(), static_cast<HValue*>(NULL),
2917 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
2902 HObjectAccess access = HObjectAccess::ForJSObjectOffset( 2918 HObjectAccess access = HObjectAccess::ForJSObjectOffset(
2903 GlobalObject::kBuiltinsOffset); 2919 GlobalObject::kBuiltinsOffset);
2904 HValue* builtins = Add<HLoadNamedField>(global_object, access); 2920 HValue* builtins = Add<HLoadNamedField>(
2921 global_object, static_cast<HValue*>(NULL), access);
2905 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset( 2922 HObjectAccess function_access = HObjectAccess::ForJSObjectOffset(
2906 JSBuiltinsObject::OffsetOfFunctionWithId(builtin)); 2923 JSBuiltinsObject::OffsetOfFunctionWithId(builtin));
2907 return Add<HLoadNamedField>(builtins, function_access); 2924 return Add<HLoadNamedField>(
2925 builtins, static_cast<HValue*>(NULL), function_access);
2908 } 2926 }
2909 2927
2910 2928
2911 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info) 2929 HOptimizedGraphBuilder::HOptimizedGraphBuilder(CompilationInfo* info)
2912 : HGraphBuilder(info), 2930 : HGraphBuilder(info),
2913 function_state_(NULL), 2931 function_state_(NULL),
2914 initial_function_state_(this, info, NORMAL_RETURN), 2932 initial_function_state_(this, info, NORMAL_RETURN),
2915 ast_context_(NULL), 2933 ast_context_(NULL),
2916 break_scope_(NULL), 2934 break_scope_(NULL),
2917 inlined_count_(0), 2935 inlined_count_(0),
(...skipping 1855 matching lines...) Expand 10 before | Expand all | Expand 10 after
4773 } 4791 }
4774 HConstant* constant = New<HConstant>(constant_object); 4792 HConstant* constant = New<HConstant>(constant_object);
4775 return ast_context()->ReturnInstruction(constant, expr->id()); 4793 return ast_context()->ReturnInstruction(constant, expr->id());
4776 } else { 4794 } else {
4777 HLoadGlobalCell* instr = 4795 HLoadGlobalCell* instr =
4778 New<HLoadGlobalCell>(cell, lookup.GetPropertyDetails()); 4796 New<HLoadGlobalCell>(cell, lookup.GetPropertyDetails());
4779 return ast_context()->ReturnInstruction(instr, expr->id()); 4797 return ast_context()->ReturnInstruction(instr, expr->id());
4780 } 4798 }
4781 } else { 4799 } else {
4782 HValue* global_object = Add<HLoadNamedField>( 4800 HValue* global_object = Add<HLoadNamedField>(
4783 context(), HObjectAccess::ForContextSlot( 4801 context(), static_cast<HValue*>(NULL),
4784 Context::GLOBAL_OBJECT_INDEX)); 4802 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
4785 HLoadGlobalGeneric* instr = 4803 HLoadGlobalGeneric* instr =
4786 New<HLoadGlobalGeneric>(global_object, 4804 New<HLoadGlobalGeneric>(global_object,
4787 variable->name(), 4805 variable->name(),
4788 ast_context()->is_for_typeof()); 4806 ast_context()->is_for_typeof());
4789 return ast_context()->ReturnInstruction(instr, expr->id()); 4807 return ast_context()->ReturnInstruction(instr, expr->id());
4790 } 4808 }
4791 } 4809 }
4792 4810
4793 case Variable::PARAMETER: 4811 case Variable::PARAMETER:
4794 case Variable::LOCAL: { 4812 case Variable::LOCAL: {
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
5299 pretenure_flag, 5317 pretenure_flag,
5300 HEAP_NUMBER_TYPE); 5318 HEAP_NUMBER_TYPE);
5301 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map()); 5319 AddStoreMapConstant(heap_number, isolate()->factory()->heap_number_map());
5302 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(), 5320 Add<HStoreNamedField>(heap_number, HObjectAccess::ForHeapNumberValue(),
5303 value, INITIALIZING_STORE); 5321 value, INITIALIZING_STORE);
5304 instr = New<HStoreNamedField>(checked_object->ActualValue(), 5322 instr = New<HStoreNamedField>(checked_object->ActualValue(),
5305 heap_number_access, 5323 heap_number_access,
5306 heap_number, INITIALIZING_STORE); 5324 heap_number, INITIALIZING_STORE);
5307 } else { 5325 } else {
5308 // Already holds a HeapNumber; load the box and write its value field. 5326 // Already holds a HeapNumber; load the box and write its value field.
5309 HInstruction* heap_number = Add<HLoadNamedField>(checked_object, 5327 HInstruction* heap_number = Add<HLoadNamedField>(
5310 heap_number_access); 5328 checked_object, static_cast<HValue*>(NULL), heap_number_access);
5311 heap_number->set_type(HType::HeapNumber()); 5329 heap_number->set_type(HType::HeapNumber());
5312 instr = New<HStoreNamedField>(heap_number, 5330 instr = New<HStoreNamedField>(heap_number,
5313 HObjectAccess::ForHeapNumberValue(), 5331 HObjectAccess::ForHeapNumberValue(),
5314 value, STORE_TO_INITIALIZED_ENTRY); 5332 value, STORE_TO_INITIALIZED_ENTRY);
5315 } 5333 }
5316 } else { 5334 } else {
5317 // This is a normal store. 5335 // This is a normal store.
5318 instr = New<HStoreNamedField>( 5336 instr = New<HStoreNamedField>(
5319 checked_object->ActualValue(), field_access, value, 5337 checked_object->ActualValue(), field_access, value,
5320 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY); 5338 transition_to_field ? INITIALIZING_STORE : STORE_TO_INITIALIZED_ENTRY);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
5519 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic( 5537 HInstruction* HOptimizedGraphBuilder::BuildLoadMonomorphic(
5520 PropertyAccessInfo* info, 5538 PropertyAccessInfo* info,
5521 HValue* object, 5539 HValue* object,
5522 HInstruction* checked_object, 5540 HInstruction* checked_object,
5523 BailoutId ast_id, 5541 BailoutId ast_id,
5524 BailoutId return_id, 5542 BailoutId return_id,
5525 bool can_inline_accessor) { 5543 bool can_inline_accessor) {
5526 5544
5527 HObjectAccess access = HObjectAccess::ForMap(); // bogus default 5545 HObjectAccess access = HObjectAccess::ForMap(); // bogus default
5528 if (info->GetJSObjectFieldAccess(&access)) { 5546 if (info->GetJSObjectFieldAccess(&access)) {
5529 return New<HLoadNamedField>(checked_object, access); 5547 return New<HLoadNamedField>(
5548 checked_object, static_cast<HValue*>(NULL), access);
5530 } 5549 }
5531 5550
5532 HValue* checked_holder = checked_object; 5551 HValue* checked_holder = checked_object;
5533 if (info->has_holder()) { 5552 if (info->has_holder()) {
5534 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype())); 5553 Handle<JSObject> prototype(JSObject::cast(info->map()->prototype()));
5535 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder()); 5554 checked_holder = BuildCheckPrototypeMaps(prototype, info->holder());
5536 } 5555 }
5537 5556
5538 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined(); 5557 if (!info->lookup()->IsFound()) return graph()->GetConstantUndefined();
5539 5558
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5899 Deoptimizer::EAGER); 5918 Deoptimizer::EAGER);
5900 builder.End(); 5919 builder.End();
5901 } 5920 }
5902 HInstruction* instr = 5921 HInstruction* instr =
5903 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails()); 5922 Add<HStoreGlobalCell>(value, cell, lookup.GetPropertyDetails());
5904 if (instr->HasObservableSideEffects()) { 5923 if (instr->HasObservableSideEffects()) {
5905 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 5924 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
5906 } 5925 }
5907 } else { 5926 } else {
5908 HValue* global_object = Add<HLoadNamedField>( 5927 HValue* global_object = Add<HLoadNamedField>(
5909 context(), HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 5928 context(), static_cast<HValue*>(NULL),
5929 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
5910 HStoreNamedGeneric* instr = 5930 HStoreNamedGeneric* instr =
5911 Add<HStoreNamedGeneric>(global_object, var->name(), 5931 Add<HStoreNamedGeneric>(global_object, var->name(),
5912 value, function_strict_mode_flag()); 5932 value, function_strict_mode_flag());
5913 USE(instr); 5933 USE(instr);
5914 ASSERT(instr->HasObservableSideEffects()); 5934 ASSERT(instr->HasObservableSideEffects());
5915 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); 5935 Add<HSimulate>(ast_id, REMOVABLE_SIMULATE);
5916 } 5936 }
5917 } 5937 }
5918 5938
5919 5939
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
6174 FinishExitCurrentBlock(New<HAbnormalExit>()); 6194 FinishExitCurrentBlock(New<HAbnormalExit>());
6175 } 6195 }
6176 } 6196 }
6177 6197
6178 6198
6179 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object, 6199 HLoadNamedField* HGraphBuilder::BuildLoadNamedField(HValue* object,
6180 HObjectAccess access) { 6200 HObjectAccess access) {
6181 if (FLAG_track_double_fields && access.representation().IsDouble()) { 6201 if (FLAG_track_double_fields && access.representation().IsDouble()) {
6182 // load the heap number 6202 // load the heap number
6183 HLoadNamedField* heap_number = Add<HLoadNamedField>( 6203 HLoadNamedField* heap_number = Add<HLoadNamedField>(
6184 object, access.WithRepresentation(Representation::Tagged())); 6204 object, static_cast<HValue*>(NULL),
6205 access.WithRepresentation(Representation::Tagged()));
6185 heap_number->set_type(HType::HeapNumber()); 6206 heap_number->set_type(HType::HeapNumber());
6186 // load the double value from it 6207 // load the double value from it
6187 return New<HLoadNamedField>( 6208 return New<HLoadNamedField>(
6188 heap_number, HObjectAccess::ForHeapNumberValue()); 6209 heap_number, static_cast<HValue*>(NULL),
6210 HObjectAccess::ForHeapNumberValue());
6189 } 6211 }
6190 return New<HLoadNamedField>(object, access); 6212 return New<HLoadNamedField>(object, static_cast<HValue*>(NULL), access);
6191 } 6213 }
6192 6214
6193 6215
6194 HInstruction* HGraphBuilder::AddLoadNamedField(HValue* object, 6216 HInstruction* HGraphBuilder::AddLoadNamedField(HValue* object,
6195 HObjectAccess access) { 6217 HObjectAccess access) {
6196 return AddInstruction(BuildLoadNamedField(object, access)); 6218 return AddInstruction(BuildLoadNamedField(object, access));
6197 } 6219 }
6198 6220
6199 6221
6200 HInstruction* HGraphBuilder::AddLoadStringInstanceType(HValue* string) { 6222 HInstruction* HGraphBuilder::AddLoadStringInstanceType(HValue* string) {
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
6833 bool dont_adapt_arguments = 6855 bool dont_adapt_arguments =
6834 (formal_parameter_count == 6856 (formal_parameter_count ==
6835 SharedFunctionInfo::kDontAdaptArgumentsSentinel); 6857 SharedFunctionInfo::kDontAdaptArgumentsSentinel);
6836 int arity = argument_count - 1; 6858 int arity = argument_count - 1;
6837 bool can_invoke_directly = 6859 bool can_invoke_directly =
6838 dont_adapt_arguments || formal_parameter_count == arity; 6860 dont_adapt_arguments || formal_parameter_count == arity;
6839 if (can_invoke_directly) { 6861 if (can_invoke_directly) {
6840 return NewPlainFunctionCall(target, argument_count, dont_adapt_arguments); 6862 return NewPlainFunctionCall(target, argument_count, dont_adapt_arguments);
6841 } else { 6863 } else {
6842 HValue* param_count_value = Add<HConstant>(formal_parameter_count); 6864 HValue* param_count_value = Add<HConstant>(formal_parameter_count);
6843 HValue* context = Add<HLoadNamedField>(target, 6865 HValue* context = Add<HLoadNamedField>(
6866 target, static_cast<HValue*>(NULL),
6844 HObjectAccess::ForFunctionContextPointer()); 6867 HObjectAccess::ForFunctionContextPointer());
6845 return NewArgumentAdaptorCall(target, context, 6868 return NewArgumentAdaptorCall(target, context,
6846 argument_count, param_count_value); 6869 argument_count, param_count_value);
6847 } 6870 }
6848 UNREACHABLE(); 6871 UNREACHABLE();
6849 return NULL; 6872 return NULL;
6850 } 6873 }
6851 6874
6852 6875
6853 HInstruction* HOptimizedGraphBuilder::NewCallNamed( 6876 HInstruction* HOptimizedGraphBuilder::NewCallNamed(
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
7666 HValue* receiver = Pop(); 7689 HValue* receiver = Pop();
7667 { NoObservableSideEffectsScope scope(this); 7690 { NoObservableSideEffectsScope scope(this);
7668 checked_object = AddCheckMap(receiver, receiver_map); 7691 checked_object = AddCheckMap(receiver, receiver_map);
7669 HValue* elements = AddLoadElements(checked_object); 7692 HValue* elements = AddLoadElements(checked_object);
7670 // Ensure that we aren't popping from a copy-on-write array. 7693 // Ensure that we aren't popping from a copy-on-write array.
7671 if (IsFastSmiOrObjectElementsKind(elements_kind)) { 7694 if (IsFastSmiOrObjectElementsKind(elements_kind)) {
7672 Add<HCheckMaps>( 7695 Add<HCheckMaps>(
7673 elements, isolate()->factory()->fixed_array_map(), top_info()); 7696 elements, isolate()->factory()->fixed_array_map(), top_info());
7674 } 7697 }
7675 HValue* length = Add<HLoadNamedField>( 7698 HValue* length = Add<HLoadNamedField>(
7676 checked_object, HObjectAccess::ForArrayLength(elements_kind)); 7699 checked_object, static_cast<HValue*>(NULL),
7700 HObjectAccess::ForArrayLength(elements_kind));
7677 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1()); 7701 reduced_length = AddUncasted<HSub>(length, graph()->GetConstant1());
7678 HValue* bounds_check = Add<HBoundsCheck>( 7702 HValue* bounds_check = Add<HBoundsCheck>(
7679 graph()->GetConstant0(), length); 7703 graph()->GetConstant0(), length);
7680 result = AddElementAccess(elements, reduced_length, NULL, 7704 result = AddElementAccess(elements, reduced_length, NULL,
7681 bounds_check, elements_kind, false); 7705 bounds_check, elements_kind, false);
7682 Factory* factory = isolate()->factory(); 7706 Factory* factory = isolate()->factory();
7683 double nan_double = FixedDoubleArray::hole_nan_as_double(); 7707 double nan_double = FixedDoubleArray::hole_nan_as_double();
7684 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind) 7708 HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind)
7685 ? Add<HConstant>(factory->the_hole_value()) 7709 ? Add<HConstant>(factory->the_hole_value())
7686 : Add<HConstant>(nan_double); 7710 : Add<HConstant>(nan_double);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
7824 return true; 7848 return true;
7825 } 7849 }
7826 } 7850 }
7827 7851
7828 7852
7829 HValue* HOptimizedGraphBuilder::ImplicitReceiverFor(HValue* function, 7853 HValue* HOptimizedGraphBuilder::ImplicitReceiverFor(HValue* function,
7830 Handle<JSFunction> target) { 7854 Handle<JSFunction> target) {
7831 SharedFunctionInfo* shared = target->shared(); 7855 SharedFunctionInfo* shared = target->shared();
7832 if (shared->is_classic_mode() && !shared->native()) { 7856 if (shared->is_classic_mode() && !shared->native()) {
7833 HValue* context = Add<HLoadNamedField>( 7857 HValue* context = Add<HLoadNamedField>(
7834 function, 7858 function, static_cast<HValue*>(NULL),
7835 HObjectAccess::ForJSObjectOffset(JSFunction::kContextOffset)); 7859 HObjectAccess::ForJSObjectOffset(JSFunction::kContextOffset));
7836 HValue* global_object = Add<HLoadNamedField>( 7860 HValue* global_object = Add<HLoadNamedField>(
7837 context, 7861 context, static_cast<HValue*>(NULL),
7838 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX)); 7862 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
7839 return Add<HLoadNamedField>( 7863 return Add<HLoadNamedField>(
7840 global_object, 7864 global_object, static_cast<HValue*>(NULL),
7841 HObjectAccess::ForJSObjectOffset( 7865 HObjectAccess::ForJSObjectOffset(
7842 GlobalObject::kGlobalReceiverOffset)); 7866 GlobalObject::kGlobalReceiverOffset));
7843 } 7867 }
7844 return graph()->GetConstantUndefined(); 7868 return graph()->GetConstantUndefined();
7845 } 7869 }
7846 7870
7847 7871
7848 void HOptimizedGraphBuilder::VisitCall(Call* expr) { 7872 void HOptimizedGraphBuilder::VisitCall(Call* expr) {
7849 ASSERT(!HasStackOverflow()); 7873 ASSERT(!HasStackOverflow());
7850 ASSERT(current_block() != NULL); 7874 ASSERT(current_block() != NULL);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
7953 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false); 7977 GlobalPropertyAccess type = LookupGlobalProperty(var, &lookup, false);
7954 if (type == kUseCell && 7978 if (type == kUseCell &&
7955 !current_info()->global_object()->IsAccessCheckNeeded()) { 7979 !current_info()->global_object()->IsAccessCheckNeeded()) {
7956 Handle<GlobalObject> global(current_info()->global_object()); 7980 Handle<GlobalObject> global(current_info()->global_object());
7957 known_global_function = expr->ComputeGlobalTarget(global, &lookup); 7981 known_global_function = expr->ComputeGlobalTarget(global, &lookup);
7958 } 7982 }
7959 if (known_global_function) { 7983 if (known_global_function) {
7960 // Push the global object instead of the global receiver because 7984 // Push the global object instead of the global receiver because
7961 // code generated by the full code generator expects it. 7985 // code generated by the full code generator expects it.
7962 HValue* global_object = Add<HLoadNamedField>( 7986 HValue* global_object = Add<HLoadNamedField>(
7963 context(), HObjectAccess::ForContextSlot( 7987 context(), static_cast<HValue*>(NULL),
7964 Context::GLOBAL_OBJECT_INDEX)); 7988 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
7965 Push(global_object); 7989 Push(global_object);
7966 7990
7967 CHECK_ALIVE(VisitExpressions(expr->arguments())); 7991 CHECK_ALIVE(VisitExpressions(expr->arguments()));
7968 7992
7969 CHECK_ALIVE(VisitForValue(expr->expression())); 7993 CHECK_ALIVE(VisitForValue(expr->expression()));
7970 HValue* function = Pop(); 7994 HValue* function = Pop();
7971 Add<HCheckValue>(function, expr->target()); 7995 Add<HCheckValue>(function, expr->target());
7972 7996
7973 // Patch the global object on the stack by the expected receiver. 7997 // Patch the global object on the stack by the expected receiver.
7974 HValue* receiver = ImplicitReceiverFor(function, expr->target()); 7998 HValue* receiver = ImplicitReceiverFor(function, expr->target());
(...skipping 11 matching lines...) Expand all
7986 if (TryInlineCall(expr)) return; 8010 if (TryInlineCall(expr)) return;
7987 8011
7988 if (expr->target().is_identical_to(current_info()->closure())) { 8012 if (expr->target().is_identical_to(current_info()->closure())) {
7989 graph()->MarkRecursive(); 8013 graph()->MarkRecursive();
7990 } 8014 }
7991 8015
7992 if (CallStubCompiler::HasCustomCallGenerator(expr->target())) { 8016 if (CallStubCompiler::HasCustomCallGenerator(expr->target())) {
7993 // We're about to install a contextual IC, which expects the global 8017 // We're about to install a contextual IC, which expects the global
7994 // object as receiver rather than the global proxy. 8018 // object as receiver rather than the global proxy.
7995 HValue* global_object = Add<HLoadNamedField>( 8019 HValue* global_object = Add<HLoadNamedField>(
7996 context(), HObjectAccess::ForContextSlot( 8020 context(), static_cast<HValue*>(NULL),
7997 Context::GLOBAL_OBJECT_INDEX)); 8021 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
7998 const int receiver_index = argument_count - 1; 8022 const int receiver_index = argument_count - 1;
7999 environment()->SetExpressionStackAt(receiver_index, global_object); 8023 environment()->SetExpressionStackAt(receiver_index, global_object);
8000 // When the target has a custom call IC generator, use the IC, 8024 // When the target has a custom call IC generator, use the IC,
8001 // because it is likely to generate better code. 8025 // because it is likely to generate better code.
8002 call = NewCallNamed(var->name(), argument_count); 8026 call = NewCallNamed(var->name(), argument_count);
8003 PushArgumentsFromEnvironment(argument_count); 8027 PushArgumentsFromEnvironment(argument_count);
8004 } else { 8028 } else {
8005 call = BuildCallConstantFunction(expr->target(), argument_count); 8029 call = BuildCallConstantFunction(expr->target(), argument_count);
8006 PushArgumentsFromEnvironment(argument_count); 8030 PushArgumentsFromEnvironment(argument_count);
8007 } 8031 }
8008 } else { 8032 } else {
8009 HValue* receiver = Add<HLoadNamedField>( 8033 HValue* receiver = Add<HLoadNamedField>(
8010 context(), HObjectAccess::ForContextSlot( 8034 context(), static_cast<HValue*>(NULL),
8011 Context::GLOBAL_OBJECT_INDEX)); 8035 HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
8012 Push(Add<HPushArgument>(receiver)); 8036 Push(Add<HPushArgument>(receiver));
8013 CHECK_ALIVE(VisitArgumentList(expr->arguments())); 8037 CHECK_ALIVE(VisitArgumentList(expr->arguments()));
8014 8038
8015 call = NewCallNamed(var->name(), argument_count); 8039 call = NewCallNamed(var->name(), argument_count);
8016 Drop(argument_count); 8040 Drop(argument_count);
8017 } 8041 }
8018 8042
8019 } else if (expr->IsMonomorphic()) { 8043 } else if (expr->IsMonomorphic()) {
8020 // The function is on the stack in the unoptimized code during 8044 // The function is on the stack in the unoptimized code during
8021 // evaluation of the arguments. 8045 // evaluation of the arguments.
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
8220 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ? 8244 (FLAG_pretenuring_call_new && !FLAG_allocation_site_pretenuring) ?
8221 isolate()->heap()->GetPretenureMode() : NOT_TENURED; 8245 isolate()->heap()->GetPretenureMode() : NOT_TENURED;
8222 HAllocate* receiver = 8246 HAllocate* receiver =
8223 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag, 8247 Add<HAllocate>(size_in_bytes, HType::JSObject(), pretenure_flag,
8224 JS_OBJECT_TYPE); 8248 JS_OBJECT_TYPE);
8225 receiver->set_known_initial_map(initial_map); 8249 receiver->set_known_initial_map(initial_map);
8226 8250
8227 // Load the initial map from the constructor. 8251 // Load the initial map from the constructor.
8228 HValue* constructor_value = Add<HConstant>(constructor); 8252 HValue* constructor_value = Add<HConstant>(constructor);
8229 HValue* initial_map_value = 8253 HValue* initial_map_value =
8230 Add<HLoadNamedField>(constructor_value, HObjectAccess::ForJSObjectOffset( 8254 Add<HLoadNamedField>(constructor_value, static_cast<HValue*>(NULL),
8231 JSFunction::kPrototypeOrInitialMapOffset)); 8255 HObjectAccess::ForJSObjectOffset(
8256 JSFunction::kPrototypeOrInitialMapOffset));
8232 8257
8233 // Initialize map and fields of the newly allocated object. 8258 // Initialize map and fields of the newly allocated object.
8234 { NoObservableSideEffectsScope no_effects(this); 8259 { NoObservableSideEffectsScope no_effects(this);
8235 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE); 8260 ASSERT(initial_map->instance_type() == JS_OBJECT_TYPE);
8236 Add<HStoreNamedField>(receiver, 8261 Add<HStoreNamedField>(receiver,
8237 HObjectAccess::ForJSObjectOffset(JSObject::kMapOffset), 8262 HObjectAccess::ForJSObjectOffset(JSObject::kMapOffset),
8238 initial_map_value, INITIALIZING_STORE); 8263 initial_map_value, INITIALIZING_STORE);
8239 HValue* empty_fixed_array = Add<HConstant>(factory->empty_fixed_array()); 8264 HValue* empty_fixed_array = Add<HConstant>(factory->empty_fixed_array());
8240 Add<HStoreNamedField>(receiver, 8265 Add<HStoreNamedField>(receiver,
8241 HObjectAccess::ForJSObjectOffset(JSObject::kPropertiesOffset), 8266 HObjectAccess::ForJSObjectOffset(JSObject::kPropertiesOffset),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
8346 byte_offset, INITIALIZING_STORE); 8371 byte_offset, INITIALIZING_STORE);
8347 Add<HStoreNamedField>( 8372 Add<HStoreNamedField>(
8348 obj, 8373 obj,
8349 HObjectAccess::ForJSArrayBufferViewByteLength(), 8374 HObjectAccess::ForJSArrayBufferViewByteLength(),
8350 byte_length, INITIALIZING_STORE); 8375 byte_length, INITIALIZING_STORE);
8351 8376
8352 HObjectAccess weak_first_view_access = 8377 HObjectAccess weak_first_view_access =
8353 HObjectAccess::ForJSArrayBufferWeakFirstView(); 8378 HObjectAccess::ForJSArrayBufferWeakFirstView();
8354 Add<HStoreNamedField>(obj, 8379 Add<HStoreNamedField>(obj,
8355 HObjectAccess::ForJSArrayBufferViewWeakNext(), 8380 HObjectAccess::ForJSArrayBufferViewWeakNext(),
8356 Add<HLoadNamedField>(buffer, weak_first_view_access), 8381 Add<HLoadNamedField>(buffer, static_cast<HValue*>(NULL),
8382 weak_first_view_access),
8357 INITIALIZING_STORE); 8383 INITIALIZING_STORE);
8358 Add<HStoreNamedField>( 8384 Add<HStoreNamedField>(
8359 buffer, weak_first_view_access, obj, INITIALIZING_STORE); 8385 buffer, weak_first_view_access, obj, INITIALIZING_STORE);
8360 } 8386 }
8361 8387
8362 8388
8363 void HOptimizedGraphBuilder::VisitDataViewInitialize( 8389 void HOptimizedGraphBuilder::VisitDataViewInitialize(
8364 CallRuntime* expr) { 8390 CallRuntime* expr) {
8365 ZoneList<Expression*>* arguments = expr->arguments(); 8391 ZoneList<Expression*>* arguments = expr->arguments();
8366 8392
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
8453 Add<HConstant>(ExternalArray::kAlignedSize), 8479 Add<HConstant>(ExternalArray::kAlignedSize),
8454 HType::JSArray(), 8480 HType::JSArray(),
8455 NOT_TENURED, 8481 NOT_TENURED,
8456 static_cast<InstanceType>(FIRST_EXTERNAL_ARRAY_TYPE + array_type)); 8482 static_cast<InstanceType>(FIRST_EXTERNAL_ARRAY_TYPE + array_type));
8457 8483
8458 Handle<Map> external_array_map( 8484 Handle<Map> external_array_map(
8459 isolate()->heap()->MapForExternalArrayType(array_type)); 8485 isolate()->heap()->MapForExternalArrayType(array_type));
8460 AddStoreMapConstant(elements, external_array_map); 8486 AddStoreMapConstant(elements, external_array_map);
8461 8487
8462 HValue* backing_store = Add<HLoadNamedField>( 8488 HValue* backing_store = Add<HLoadNamedField>(
8463 buffer, HObjectAccess::ForJSArrayBufferBackingStore()); 8489 buffer, static_cast<HValue*>(NULL),
8490 HObjectAccess::ForJSArrayBufferBackingStore());
8464 8491
8465 HValue* typed_array_start; 8492 HValue* typed_array_start;
8466 if (is_zero_byte_offset) { 8493 if (is_zero_byte_offset) {
8467 typed_array_start = backing_store; 8494 typed_array_start = backing_store;
8468 } else { 8495 } else {
8469 HInstruction* external_pointer = 8496 HInstruction* external_pointer =
8470 AddUncasted<HAdd>(backing_store, byte_offset); 8497 AddUncasted<HAdd>(backing_store, byte_offset);
8471 // Arguments are checked prior to call to TypedArrayInitialize, 8498 // Arguments are checked prior to call to TypedArrayInitialize,
8472 // including byte_offset. 8499 // including byte_offset.
8473 external_pointer->ClearFlag(HValue::kCanOverflow); 8500 external_pointer->ClearFlag(HValue::kCanOverflow);
(...skipping 2661 matching lines...) Expand 10 before | Expand all | Expand 10 after
11135 if (ShouldProduceTraceOutput()) { 11162 if (ShouldProduceTraceOutput()) {
11136 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11163 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11137 } 11164 }
11138 11165
11139 #ifdef DEBUG 11166 #ifdef DEBUG
11140 graph_->Verify(false); // No full verify. 11167 graph_->Verify(false); // No full verify.
11141 #endif 11168 #endif
11142 } 11169 }
11143 11170
11144 } } // namespace v8::internal 11171 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698