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

Side by Side Diff: src/hydrogen.cc

Issue 1069883002: WIP SharedArrayBuffer implementation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/hydrogen.h" 5 #include "src/hydrogen.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/v8.h" 9 #include "src/v8.h"
10 10
(...skipping 6054 matching lines...) Expand 10 before | Expand all | Expand 10 after
6065 LookupDescriptor(*map, *name_); 6065 LookupDescriptor(*map, *name_);
6066 if (IsFound()) return LoadResult(map); 6066 if (IsFound()) return LoadResult(map);
6067 } 6067 }
6068 NotFound(); 6068 NotFound();
6069 return true; 6069 return true;
6070 } 6070 }
6071 6071
6072 6072
6073 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsIntegerIndexedExotic() { 6073 bool HOptimizedGraphBuilder::PropertyAccessInfo::IsIntegerIndexedExotic() {
6074 InstanceType instance_type = map_->instance_type(); 6074 InstanceType instance_type = map_->instance_type();
6075 return instance_type == JS_TYPED_ARRAY_TYPE && 6075 return (instance_type == JS_TYPED_ARRAY_TYPE ||
6076 instance_type == JS_SHARED_TYPED_ARRAY_TYPE) &&
6076 IsSpecialIndex(isolate()->unicode_cache(), *name_); 6077 IsSpecialIndex(isolate()->unicode_cache(), *name_);
6077 } 6078 }
6078 6079
6079 6080
6080 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() { 6081 bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic() {
6081 if (!CanInlinePropertyAccess(map_)) return false; 6082 if (!CanInlinePropertyAccess(map_)) return false;
6082 if (IsJSObjectFieldAccessor()) return IsLoad(); 6083 if (IsJSObjectFieldAccessor()) return IsLoad();
6083 if (map_->function_with_prototype() && !map_->has_non_instance_prototype() && 6084 if (map_->function_with_prototype() && !map_->has_non_instance_prototype() &&
6084 name_.is_identical_to(isolate()->factory()->prototype_string())) { 6085 name_.is_identical_to(isolate()->factory()->prototype_string())) {
6085 return IsLoad(); 6086 return IsLoad();
(...skipping 3628 matching lines...) Expand 10 before | Expand all | Expand 10 after
9714 9715
9715 void HOptimizedGraphBuilder::GenerateTypedArrayInitialize( 9716 void HOptimizedGraphBuilder::GenerateTypedArrayInitialize(
9716 CallRuntime* expr) { 9717 CallRuntime* expr) {
9717 ZoneList<Expression*>* arguments = expr->arguments(); 9718 ZoneList<Expression*>* arguments = expr->arguments();
9718 9719
9719 static const int kObjectArg = 0; 9720 static const int kObjectArg = 0;
9720 static const int kArrayIdArg = 1; 9721 static const int kArrayIdArg = 1;
9721 static const int kBufferArg = 2; 9722 static const int kBufferArg = 2;
9722 static const int kByteOffsetArg = 3; 9723 static const int kByteOffsetArg = 3;
9723 static const int kByteLengthArg = 4; 9724 static const int kByteLengthArg = 4;
9724 static const int kArgsLength = 5; 9725 static const int kIsSharedArg = 5;
9726 static const int kArgsLength = 6;
9725 DCHECK(arguments->length() == kArgsLength); 9727 DCHECK(arguments->length() == kArgsLength);
9726 9728
9727 9729
9728 CHECK_ALIVE(VisitForValue(arguments->at(kObjectArg))); 9730 CHECK_ALIVE(VisitForValue(arguments->at(kObjectArg)));
9729 HValue* obj = Pop(); 9731 HValue* obj = Pop();
9730 9732
9731 if (arguments->at(kArrayIdArg)->IsLiteral()) { 9733 if (arguments->at(kArrayIdArg)->IsLiteral()) {
9732 // This should never happen in real use, but can happen when fuzzing. 9734 // This should never happen in real use, but can happen when fuzzing.
9733 // Just bail out. 9735 // Just bail out.
9734 Bailout(kNeedSmiLiteral); 9736 Bailout(kNeedSmiLiteral);
(...skipping 28 matching lines...) Expand all
9763 } else { 9765 } else {
9764 CHECK_ALIVE(VisitForValue(arguments->at(kByteOffsetArg))); 9766 CHECK_ALIVE(VisitForValue(arguments->at(kByteOffsetArg)));
9765 byte_offset = Pop(); 9767 byte_offset = Pop();
9766 is_zero_byte_offset = false; 9768 is_zero_byte_offset = false;
9767 DCHECK(buffer != NULL); 9769 DCHECK(buffer != NULL);
9768 } 9770 }
9769 9771
9770 CHECK_ALIVE(VisitForValue(arguments->at(kByteLengthArg))); 9772 CHECK_ALIVE(VisitForValue(arguments->at(kByteLengthArg)));
9771 HValue* byte_length = Pop(); 9773 HValue* byte_length = Pop();
9772 9774
9775 CHECK_ALIVE(VisitForValue(arguments->at(kIsSharedArg)));
9776 HValue* is_shared = Pop();
9777
9773 NoObservableSideEffectsScope scope(this); 9778 NoObservableSideEffectsScope scope(this);
9774 IfBuilder byte_offset_smi(this); 9779 IfBuilder byte_offset_smi(this);
9775 9780
9776 if (!is_zero_byte_offset) { 9781 if (!is_zero_byte_offset) {
9777 byte_offset_smi.If<HIsSmiAndBranch>(byte_offset); 9782 byte_offset_smi.If<HIsSmiAndBranch>(byte_offset);
9778 byte_offset_smi.Then(); 9783 byte_offset_smi.Then();
9779 } 9784 }
9780 9785
9781 ExternalArrayType array_type = 9786 ExternalArrayType array_type =
9782 kExternalInt8Array; // Bogus initialization. 9787 kExternalInt8Array; // Bogus initialization.
(...skipping 14 matching lines...) Expand all
9797 obj, buffer, byte_offset, byte_length); 9802 obj, buffer, byte_offset, byte_length);
9798 9803
9799 9804
9800 HInstruction* length = AddUncasted<HDiv>(byte_length, 9805 HInstruction* length = AddUncasted<HDiv>(byte_length,
9801 Add<HConstant>(static_cast<int32_t>(element_size))); 9806 Add<HConstant>(static_cast<int32_t>(element_size)));
9802 9807
9803 Add<HStoreNamedField>(obj, 9808 Add<HStoreNamedField>(obj,
9804 HObjectAccess::ForJSTypedArrayLength(), 9809 HObjectAccess::ForJSTypedArrayLength(),
9805 length); 9810 length);
9806 9811
9812 Add<HStoreNamedField>(obj, HObjectAccess::ForJSTypedArrayIsShared(),
9813 is_shared);
9814
9807 HValue* elements; 9815 HValue* elements;
9808 if (buffer != NULL) { 9816 if (buffer != NULL) {
9809 elements = BuildAllocateExternalElements( 9817 elements = BuildAllocateExternalElements(
9810 array_type, is_zero_byte_offset, buffer, byte_offset, length); 9818 array_type, is_zero_byte_offset, buffer, byte_offset, length);
9811 Handle<Map> obj_map = TypedArrayMap( 9819 Handle<Map> obj_map = TypedArrayMap(
9812 isolate(), array_type, external_elements_kind); 9820 isolate(), array_type, external_elements_kind);
9813 AddStoreMapConstant(obj, obj_map); 9821 AddStoreMapConstant(obj, obj_map);
9814 } else { 9822 } else {
9815 DCHECK(is_zero_byte_offset); 9823 DCHECK(is_zero_byte_offset);
9816 elements = BuildAllocateFixedTypedArray( 9824 elements = BuildAllocateFixedTypedArray(
(...skipping 3105 matching lines...) Expand 10 before | Expand all | Expand 10 after
12922 if (ShouldProduceTraceOutput()) { 12930 if (ShouldProduceTraceOutput()) {
12923 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 12931 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
12924 } 12932 }
12925 12933
12926 #ifdef DEBUG 12934 #ifdef DEBUG
12927 graph_->Verify(false); // No full verify. 12935 graph_->Verify(false); // No full verify.
12928 #endif 12936 #endif
12929 } 12937 }
12930 12938
12931 } } // namespace v8::internal 12939 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698