Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 7902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7913 &HOptimizedGraphBuilder::Generate##Name, | 7913 &HOptimizedGraphBuilder::Generate##Name, |
| 7914 | 7914 |
| 7915 const HOptimizedGraphBuilder::InlineFunctionGenerator | 7915 const HOptimizedGraphBuilder::InlineFunctionGenerator |
| 7916 HOptimizedGraphBuilder::kInlineFunctionGenerators[] = { | 7916 HOptimizedGraphBuilder::kInlineFunctionGenerators[] = { |
| 7917 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) | 7917 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
| 7918 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) | 7918 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS) |
| 7919 }; | 7919 }; |
| 7920 #undef INLINE_FUNCTION_GENERATOR_ADDRESS | 7920 #undef INLINE_FUNCTION_GENERATOR_ADDRESS |
| 7921 | 7921 |
| 7922 | 7922 |
| 7923 void HOptimizedGraphBuilder::VisitDataViewInitialize( | |
| 7924 CallRuntime* expr) { | |
| 7925 ZoneList<Expression*>* arguments = expr->arguments(); | |
| 7926 | |
| 7927 NoObservableSideEffectsScope scope(this); | |
| 7928 ASSERT(arguments->length()== 4); | |
| 7929 CHECK_ALIVE(VisitForValue(arguments->at(0))); | |
| 7930 HValue* obj = Pop(); | |
| 7931 | |
| 7932 CHECK_ALIVE(VisitForValue(arguments->at(1))); | |
| 7933 HValue* buffer = Pop(); | |
| 7934 | |
| 7935 CHECK_ALIVE(VisitForValue(arguments->at(2))); | |
| 7936 HValue* byte_offset = Pop(); | |
| 7937 | |
| 7938 CHECK_ALIVE(VisitForValue(arguments->at(3))); | |
| 7939 HValue* byte_length = Pop(); | |
| 7940 | |
| 7941 for (int offset = JSDataView::kSize; | |
| 7942 offset < JSDataView::kSizeWithInternalFields; | |
| 7943 offset += kPointerSize) { | |
| 7944 Add<HStoreNamedField>(obj, | |
| 7945 HObjectAccess::ForJSObjectOffset(offset), | |
| 7946 Add<HConstant>(static_cast<int32_t>(0))); | |
| 7947 } | |
| 7948 | |
| 7949 Add<HStoreNamedField>(obj, | |
| 7950 HObjectAccess::ForJSObjectOffset(JSDataView::kBufferOffset), buffer); | |
| 7951 Add<HStoreNamedField>(obj, | |
| 7952 HObjectAccess::ForJSObjectOffset(JSDataView::kByteOffsetOffset), | |
| 7953 byte_offset); | |
|
Benedikt Meurer
2013/11/18 08:02:31
byte_offset should be a SMI, so you should pass Re
Dmitry Lomov (no reviews)
2013/11/18 08:46:47
Byte offset is not neccessarily a smi here. Ditto
| |
| 7954 Add<HStoreNamedField>(obj, | |
| 7955 HObjectAccess::ForJSObjectOffset(JSDataView::kByteLengthOffset), | |
|
Benedikt Meurer
2013/11/18 08:02:31
byte_length is a SMI, so you should pass Represent
| |
| 7956 byte_length); | |
| 7957 | |
| 7958 Add<HStoreNamedField>(obj, | |
| 7959 HObjectAccess::ForJSObjectOffset(JSDataView::kWeakNextOffset), | |
| 7960 Add<HLoadNamedField>(buffer, | |
| 7961 HObjectAccess::ForJSObjectOffset( | |
| 7962 JSArrayBuffer::kWeakFirstViewOffset))); | |
| 7963 Add<HStoreNamedField>(buffer, | |
| 7964 HObjectAccess::ForJSObjectOffset(JSArrayBuffer::kWeakFirstViewOffset), | |
| 7965 obj); | |
| 7966 } | |
| 7967 | |
| 7968 | |
| 7923 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 7969 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
| 7924 ASSERT(!HasStackOverflow()); | 7970 ASSERT(!HasStackOverflow()); |
| 7925 ASSERT(current_block() != NULL); | 7971 ASSERT(current_block() != NULL); |
| 7926 ASSERT(current_block()->HasPredecessor()); | 7972 ASSERT(current_block()->HasPredecessor()); |
| 7927 if (expr->is_jsruntime()) { | 7973 if (expr->is_jsruntime()) { |
| 7928 return Bailout(kCallToAJavaScriptRuntimeFunction); | 7974 return Bailout(kCallToAJavaScriptRuntimeFunction); |
| 7929 } | 7975 } |
| 7930 | 7976 |
| 7931 const Runtime::Function* function = expr->function(); | 7977 const Runtime::Function* function = expr->function(); |
| 7932 ASSERT(function != NULL); | 7978 ASSERT(function != NULL); |
| 7979 | |
| 7980 if (function->function_id == Runtime::kDataViewInitialize) { | |
| 7981 return VisitDataViewInitialize(expr); | |
| 7982 } | |
| 7983 | |
| 7933 if (function->intrinsic_type == Runtime::INLINE) { | 7984 if (function->intrinsic_type == Runtime::INLINE) { |
| 7934 ASSERT(expr->name()->length() > 0); | 7985 ASSERT(expr->name()->length() > 0); |
| 7935 ASSERT(expr->name()->Get(0) == '_'); | 7986 ASSERT(expr->name()->Get(0) == '_'); |
| 7936 // Call to an inline function. | 7987 // Call to an inline function. |
| 7937 int lookup_index = static_cast<int>(function->function_id) - | 7988 int lookup_index = static_cast<int>(function->function_id) - |
| 7938 static_cast<int>(Runtime::kFirstInlineFunction); | 7989 static_cast<int>(Runtime::kFirstInlineFunction); |
| 7939 ASSERT(lookup_index >= 0); | 7990 ASSERT(lookup_index >= 0); |
| 7940 ASSERT(static_cast<size_t>(lookup_index) < | 7991 ASSERT(static_cast<size_t>(lookup_index) < |
| 7941 ARRAY_SIZE(kInlineFunctionGenerators)); | 7992 ARRAY_SIZE(kInlineFunctionGenerators)); |
| 7942 InlineFunctionGenerator generator = kInlineFunctionGenerators[lookup_index]; | 7993 InlineFunctionGenerator generator = kInlineFunctionGenerators[lookup_index]; |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10418 if (ShouldProduceTraceOutput()) { | 10469 if (ShouldProduceTraceOutput()) { |
| 10419 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10470 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
| 10420 } | 10471 } |
| 10421 | 10472 |
| 10422 #ifdef DEBUG | 10473 #ifdef DEBUG |
| 10423 graph_->Verify(false); // No full verify. | 10474 graph_->Verify(false); // No full verify. |
| 10424 #endif | 10475 #endif |
| 10425 } | 10476 } |
| 10426 | 10477 |
| 10427 } } // namespace v8::internal | 10478 } } // namespace v8::internal |
| OLD | NEW |