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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 650843002: [turbofan] Embed the actual backing store address for typed loads/stores. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comment. Created 6 years, 2 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/compiler/js-graph.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/access-builder.h" 5 #include "src/compiler/access-builder.h"
6 #include "src/compiler/graph-inl.h" 6 #include "src/compiler/graph-inl.h"
7 #include "src/compiler/js-builtin-reducer.h" 7 #include "src/compiler/js-builtin-reducer.h"
8 #include "src/compiler/js-typed-lowering.h" 8 #include "src/compiler/js-typed-lowering.h"
9 #include "src/compiler/node-aux-data-inl.h" 9 #include "src/compiler/node-aux-data-inl.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 // a) The typed array or it's buffer is neutered. 536 // a) The typed array or it's buffer is neutered.
537 if (base_type->IsConstant() && key_type->Is(Type::Integral32()) && 537 if (base_type->IsConstant() && key_type->Is(Type::Integral32()) &&
538 base_type->AsConstant()->Value()->IsJSTypedArray()) { 538 base_type->AsConstant()->Value()->IsJSTypedArray()) {
539 // JSLoadProperty(typed-array, int32) 539 // JSLoadProperty(typed-array, int32)
540 Handle<JSTypedArray> array = 540 Handle<JSTypedArray> array =
541 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); 541 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
542 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { 542 if (IsExternalArrayElementsKind(array->map()->elements_kind())) {
543 ExternalArrayType type = array->type(); 543 ExternalArrayType type = array->type();
544 uint32_t byte_length; 544 uint32_t byte_length;
545 if (array->byte_length()->ToUint32(&byte_length)) { 545 if (array->byte_length()->ToUint32(&byte_length)) {
546 Node* elements = graph()->NewNode( 546 Handle<ExternalArray> elements =
547 simplified()->LoadField(AccessBuilder::ForJSObjectElements()), base, 547 Handle<ExternalArray>::cast(handle(array->elements()));
548 graph()->start()); 548 Node* pointer = jsgraph()->IntPtrConstant(
549 Node* pointer = graph()->NewNode( 549 bit_cast<intptr_t>(elements->external_pointer()));
550 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()),
551 elements, elements);
552 Node* length = jsgraph()->Uint32Constant( 550 Node* length = jsgraph()->Uint32Constant(
553 static_cast<uint32_t>(byte_length / array->element_size())); 551 static_cast<uint32_t>(byte_length / array->element_size()));
554 Node* effect = NodeProperties::GetEffectInput(node); 552 Node* effect = NodeProperties::GetEffectInput(node);
555 Node* control = NodeProperties::GetControlInput(node); 553 Node* control = NodeProperties::GetControlInput(node);
556 Node* load = graph()->NewNode( 554 Node* load = graph()->NewNode(
557 simplified()->LoadElement( 555 simplified()->LoadElement(
558 AccessBuilder::ForTypedArrayElement(type, true)), 556 AccessBuilder::ForTypedArrayElement(type, true)),
559 pointer, key, length, effect, control); 557 pointer, key, length, effect, control);
560 return ReplaceEagerly(node, load); 558 return ReplaceEagerly(node, load);
561 } 559 }
(...skipping 13 matching lines...) Expand all
575 // a) The typed array or its buffer is neutered. 573 // a) The typed array or its buffer is neutered.
576 if (key_type->Is(Type::Integral32()) && base_type->IsConstant() && 574 if (key_type->Is(Type::Integral32()) && base_type->IsConstant() &&
577 base_type->AsConstant()->Value()->IsJSTypedArray()) { 575 base_type->AsConstant()->Value()->IsJSTypedArray()) {
578 // JSStoreProperty(typed-array, int32, value) 576 // JSStoreProperty(typed-array, int32, value)
579 Handle<JSTypedArray> array = 577 Handle<JSTypedArray> array =
580 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value()); 578 Handle<JSTypedArray>::cast(base_type->AsConstant()->Value());
581 if (IsExternalArrayElementsKind(array->map()->elements_kind())) { 579 if (IsExternalArrayElementsKind(array->map()->elements_kind())) {
582 ExternalArrayType type = array->type(); 580 ExternalArrayType type = array->type();
583 uint32_t byte_length; 581 uint32_t byte_length;
584 if (array->byte_length()->ToUint32(&byte_length)) { 582 if (array->byte_length()->ToUint32(&byte_length)) {
585 Node* elements = graph()->NewNode( 583 Handle<ExternalArray> elements =
586 simplified()->LoadField(AccessBuilder::ForJSObjectElements()), base, 584 Handle<ExternalArray>::cast(handle(array->elements()));
587 graph()->start()); 585 Node* pointer = jsgraph()->IntPtrConstant(
588 Node* pointer = graph()->NewNode( 586 bit_cast<intptr_t>(elements->external_pointer()));
589 simplified()->LoadField(AccessBuilder::ForExternalArrayPointer()),
590 elements, elements);
591 Node* length = jsgraph()->Uint32Constant( 587 Node* length = jsgraph()->Uint32Constant(
592 static_cast<uint32_t>(byte_length / array->element_size())); 588 static_cast<uint32_t>(byte_length / array->element_size()));
593 Node* effect = NodeProperties::GetEffectInput(node); 589 Node* effect = NodeProperties::GetEffectInput(node);
594 Node* control = NodeProperties::GetControlInput(node); 590 Node* control = NodeProperties::GetControlInput(node);
595 Node* store = graph()->NewNode( 591 Node* store = graph()->NewNode(
596 simplified()->StoreElement( 592 simplified()->StoreElement(
597 AccessBuilder::ForTypedArrayElement(type, true)), 593 AccessBuilder::ForTypedArrayElement(type, true)),
598 pointer, key, length, value, effect, control); 594 pointer, key, length, value, effect, control);
599 return ReplaceEagerly(node, store); 595 return ReplaceEagerly(node, store);
600 } 596 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 return JSBuiltinReducer(jsgraph()).Reduce(node); 691 return JSBuiltinReducer(jsgraph()).Reduce(node);
696 default: 692 default:
697 break; 693 break;
698 } 694 }
699 return NoChange(); 695 return NoChange();
700 } 696 }
701 697
702 } // namespace compiler 698 } // namespace compiler
703 } // namespace internal 699 } // namespace internal
704 } // namespace v8 700 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/js-graph.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698