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

Side by Side Diff: src/hydrogen.cc

Issue 203443002: Refactor inlined typed array runtime functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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/hydrogen.h ('k') | src/runtime.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 8407 matching lines...) Expand 10 before | Expand all | Expand 10 after
8418 HObjectAccess::ForJSArrayBufferWeakFirstView(); 8418 HObjectAccess::ForJSArrayBufferWeakFirstView();
8419 Add<HStoreNamedField>(obj, 8419 Add<HStoreNamedField>(obj,
8420 HObjectAccess::ForJSArrayBufferViewWeakNext(), 8420 HObjectAccess::ForJSArrayBufferViewWeakNext(),
8421 Add<HLoadNamedField>(buffer, static_cast<HValue*>(NULL), 8421 Add<HLoadNamedField>(buffer, static_cast<HValue*>(NULL),
8422 weak_first_view_access)); 8422 weak_first_view_access));
8423 Add<HStoreNamedField>( 8423 Add<HStoreNamedField>(
8424 buffer, weak_first_view_access, obj); 8424 buffer, weak_first_view_access, obj);
8425 } 8425 }
8426 8426
8427 8427
8428 void HOptimizedGraphBuilder::VisitDataViewInitialize( 8428 void HOptimizedGraphBuilder::GenerateDataViewInitialize(
8429 CallRuntime* expr) { 8429 CallRuntime* expr) {
8430 ZoneList<Expression*>* arguments = expr->arguments(); 8430 ZoneList<Expression*>* arguments = expr->arguments();
8431 8431
8432 NoObservableSideEffectsScope scope(this); 8432 NoObservableSideEffectsScope scope(this);
8433 ASSERT(arguments->length()== 4); 8433 ASSERT(arguments->length()== 4);
8434 CHECK_ALIVE(VisitForValue(arguments->at(0))); 8434 CHECK_ALIVE(VisitForValue(arguments->at(0)));
8435 HValue* obj = Pop(); 8435 HValue* obj = Pop();
8436 8436
8437 CHECK_ALIVE(VisitForValue(arguments->at(1))); 8437 CHECK_ALIVE(VisitForValue(arguments->at(1)));
8438 HValue* buffer = Pop(); 8438 HValue* buffer = Pop();
8439 8439
8440 CHECK_ALIVE(VisitForValue(arguments->at(2))); 8440 CHECK_ALIVE(VisitForValue(arguments->at(2)));
8441 HValue* byte_offset = Pop(); 8441 HValue* byte_offset = Pop();
8442 8442
8443 CHECK_ALIVE(VisitForValue(arguments->at(3))); 8443 CHECK_ALIVE(VisitForValue(arguments->at(3)));
8444 HValue* byte_length = Pop(); 8444 HValue* byte_length = Pop();
8445 8445
8446 BuildArrayBufferViewInitialization<JSDataView>( 8446 BuildArrayBufferViewInitialization<JSDataView>(
8447 obj, buffer, byte_offset, byte_length); 8447 obj, buffer, byte_offset, byte_length);
8448 } 8448 }
8449 8449
8450 8450
8451 void HOptimizedGraphBuilder::VisitTypedArrayInitialize( 8451 void HOptimizedGraphBuilder::GenerateTypedArrayInitialize(
8452 CallRuntime* expr) { 8452 CallRuntime* expr) {
8453 ZoneList<Expression*>* arguments = expr->arguments(); 8453 ZoneList<Expression*>* arguments = expr->arguments();
8454 8454
8455 NoObservableSideEffectsScope scope(this); 8455 NoObservableSideEffectsScope scope(this);
8456 static const int kObjectArg = 0; 8456 static const int kObjectArg = 0;
8457 static const int kArrayIdArg = 1; 8457 static const int kArrayIdArg = 1;
8458 static const int kBufferArg = 2; 8458 static const int kBufferArg = 2;
8459 static const int kByteOffsetArg = 3; 8459 static const int kByteOffsetArg = 3;
8460 static const int kByteLengthArg = 4; 8460 static const int kByteLengthArg = 4;
8461 static const int kArgsLength = 5; 8461 static const int kArgsLength = 5;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
8560 Push(byte_offset); 8560 Push(byte_offset);
8561 Push(byte_length); 8561 Push(byte_length);
8562 PushArgumentsFromEnvironment(kArgsLength); 8562 PushArgumentsFromEnvironment(kArgsLength);
8563 Add<HCallRuntime>(expr->name(), expr->function(), kArgsLength); 8563 Add<HCallRuntime>(expr->name(), expr->function(), kArgsLength);
8564 } 8564 }
8565 } 8565 }
8566 byte_offset_smi.End(); 8566 byte_offset_smi.End();
8567 } 8567 }
8568 8568
8569 8569
8570 void HOptimizedGraphBuilder::GenerateMaxSmi(CallRuntime* expr) {
8571 ASSERT(expr->arguments()->length() == 0);
8572 HConstant* max_smi = New<HConstant>(static_cast<int32_t>(Smi::kMaxValue));
8573 return ast_context()->ReturnInstruction(max_smi, expr->id());
8574 }
8575
8576
8570 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { 8577 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
8571 ASSERT(!HasStackOverflow()); 8578 ASSERT(!HasStackOverflow());
8572 ASSERT(current_block() != NULL); 8579 ASSERT(current_block() != NULL);
8573 ASSERT(current_block()->HasPredecessor()); 8580 ASSERT(current_block()->HasPredecessor());
8574 if (expr->is_jsruntime()) { 8581 if (expr->is_jsruntime()) {
8575 return Bailout(kCallToAJavaScriptRuntimeFunction); 8582 return Bailout(kCallToAJavaScriptRuntimeFunction);
8576 } 8583 }
8577 8584
8578 const Runtime::Function* function = expr->function(); 8585 const Runtime::Function* function = expr->function();
8579 ASSERT(function != NULL); 8586 ASSERT(function != NULL);
8580 8587
8581 if (function->function_id == Runtime::kDataViewInitialize) {
8582 return VisitDataViewInitialize(expr);
8583 }
8584
8585 if (function->function_id == Runtime::kTypedArrayInitialize) {
8586 return VisitTypedArrayInitialize(expr);
8587 }
8588
8589 if (function->function_id == Runtime::kMaxSmi) {
8590 ASSERT(expr->arguments()->length() == 0);
8591 HConstant* max_smi = New<HConstant>(static_cast<int32_t>(Smi::kMaxValue));
8592 return ast_context()->ReturnInstruction(max_smi, expr->id());
8593 }
8594
8595 if (function->intrinsic_type == Runtime::INLINE) { 8588 if (function->intrinsic_type == Runtime::INLINE) {
8596 ASSERT(expr->name()->length() > 0); 8589 ASSERT(expr->name()->length() > 0);
8597 ASSERT(expr->name()->Get(0) == '_'); 8590 ASSERT(expr->name()->Get(0) == '_');
8598 // Call to an inline function. 8591 // Call to an inline function.
8599 int lookup_index = static_cast<int>(function->function_id) - 8592 int lookup_index = static_cast<int>(function->function_id) -
8600 static_cast<int>(Runtime::kFirstInlineFunction); 8593 static_cast<int>(Runtime::kFirstInlineFunction);
8601 ASSERT(lookup_index >= 0); 8594 ASSERT(lookup_index >= 0);
8602 ASSERT(static_cast<size_t>(lookup_index) < 8595 ASSERT(static_cast<size_t>(lookup_index) <
8603 ARRAY_SIZE(kInlineFunctionGenerators)); 8596 ARRAY_SIZE(kInlineFunctionGenerators));
8604 InlineFunctionGenerator generator = kInlineFunctionGenerators[lookup_index]; 8597 InlineFunctionGenerator generator = kInlineFunctionGenerators[lookup_index];
(...skipping 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after
11297 if (ShouldProduceTraceOutput()) { 11290 if (ShouldProduceTraceOutput()) {
11298 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 11291 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
11299 } 11292 }
11300 11293
11301 #ifdef DEBUG 11294 #ifdef DEBUG
11302 graph_->Verify(false); // No full verify. 11295 graph_->Verify(false); // No full verify.
11303 #endif 11296 #endif
11304 } 11297 }
11305 11298
11306 } } // namespace v8::internal 11299 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | src/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698