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

Side by Side Diff: src/hydrogen.cc

Issue 993963002: Converted Crankshaft to have its own list of known intrinsics. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed undef Created 5 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
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | 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 // 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 9506 matching lines...) Expand 10 before | Expand all | Expand 10 after
9517 // argument to the construct call. 9517 // argument to the construct call.
9518 if (TryHandleArrayCallNew(expr, function)) return; 9518 if (TryHandleArrayCallNew(expr, function)) return;
9519 9519
9520 HInstruction* call = 9520 HInstruction* call =
9521 PreProcessCall(New<HCallNew>(function, argument_count)); 9521 PreProcessCall(New<HCallNew>(function, argument_count));
9522 return ast_context()->ReturnInstruction(call, expr->id()); 9522 return ast_context()->ReturnInstruction(call, expr->id());
9523 } 9523 }
9524 } 9524 }
9525 9525
9526 9526
9527 // Support for generating inlined runtime functions.
9528
9529 // Lookup table for generators for runtime calls that are generated inline.
9530 // Elements of the table are member pointers to functions of
9531 // HOptimizedGraphBuilder.
9532 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \
9533 &HOptimizedGraphBuilder::Generate##Name,
9534
9535 const HOptimizedGraphBuilder::InlineFunctionGenerator
9536 HOptimizedGraphBuilder::kInlineFunctionGenerators[] = {
9537 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
9538 INLINE_OPTIMIZED_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
9539 };
9540 #undef INLINE_FUNCTION_GENERATOR_ADDRESS
9541
9542
9543 HOptimizedGraphBuilder::InlineFunctionGenerator
9544 HOptimizedGraphBuilder::FindInlineFunctionGenerator(CallRuntime* expr) {
9545 const Runtime::Function* function = expr->function();
9546 if (function == nullptr || function->intrinsic_type != Runtime::INLINE) {
9547 return nullptr;
9548 }
9549 Runtime::FunctionId id = function->function_id;
9550 if (id < Runtime::kFirstInlineFunction) return nullptr;
9551 int lookup_index =
9552 static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction);
9553 DCHECK(static_cast<size_t>(lookup_index) <
9554 arraysize(kInlineFunctionGenerators));
9555 return kInlineFunctionGenerators[lookup_index];
9556 }
9557
9558
9559 template <class ViewClass> 9527 template <class ViewClass>
9560 void HGraphBuilder::BuildArrayBufferViewInitialization( 9528 void HGraphBuilder::BuildArrayBufferViewInitialization(
9561 HValue* obj, 9529 HValue* obj,
9562 HValue* buffer, 9530 HValue* buffer,
9563 HValue* byte_offset, 9531 HValue* byte_offset,
9564 HValue* byte_length) { 9532 HValue* byte_length) {
9565 9533
9566 for (int offset = ViewClass::kSize; 9534 for (int offset = ViewClass::kSize;
9567 offset < ViewClass::kSizeWithInternalFields; 9535 offset < ViewClass::kSizeWithInternalFields;
9568 offset += kPointerSize) { 9536 offset += kPointerSize) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
9927 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) { 9895 void HOptimizedGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
9928 DCHECK(!HasStackOverflow()); 9896 DCHECK(!HasStackOverflow());
9929 DCHECK(current_block() != NULL); 9897 DCHECK(current_block() != NULL);
9930 DCHECK(current_block()->HasPredecessor()); 9898 DCHECK(current_block()->HasPredecessor());
9931 if (expr->is_jsruntime()) { 9899 if (expr->is_jsruntime()) {
9932 return Bailout(kCallToAJavaScriptRuntimeFunction); 9900 return Bailout(kCallToAJavaScriptRuntimeFunction);
9933 } 9901 }
9934 9902
9935 const Runtime::Function* function = expr->function(); 9903 const Runtime::Function* function = expr->function();
9936 DCHECK(function != NULL); 9904 DCHECK(function != NULL);
9905 switch (function->function_id) {
9906 #define CALL_INTRINSIC_GENERATOR(Name) \
9907 case Runtime::kInline##Name: \
9908 return Generate##Name(expr);
9937 9909
9938 InlineFunctionGenerator generator = FindInlineFunctionGenerator(expr); 9910 FOR_EACH_HYDROGEN_INTRINSIC(CALL_INTRINSIC_GENERATOR)
9939 if (generator != nullptr) { 9911 #undef CALL_INTRINSIC_GENERATOR
9940 DCHECK(expr->name()->length() > 0); 9912 default: {
9941 DCHECK(expr->name()->Get(0) == '_'); 9913 Handle<String> name = expr->name();
9942 // Call the inline code generator using the pointer-to-member. 9914 int argument_count = expr->arguments()->length();
9943 (this->*generator)(expr); 9915 CHECK_ALIVE(VisitExpressions(expr->arguments()));
9944 } else { 9916 PushArgumentsFromEnvironment(argument_count);
9945 Handle<String> name = expr->name(); 9917 HCallRuntime* call = New<HCallRuntime>(name, function, argument_count);
9946 int argument_count = expr->arguments()->length(); 9918 return ast_context()->ReturnInstruction(call, expr->id());
9947 CHECK_ALIVE(VisitExpressions(expr->arguments())); 9919 }
9948 PushArgumentsFromEnvironment(argument_count);
9949 HCallRuntime* call = New<HCallRuntime>(name, function,
9950 argument_count);
9951 return ast_context()->ReturnInstruction(call, expr->id());
9952 } 9920 }
9953 } 9921 }
9954 9922
9955 9923
9956 void HOptimizedGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) { 9924 void HOptimizedGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) {
9957 DCHECK(!HasStackOverflow()); 9925 DCHECK(!HasStackOverflow());
9958 DCHECK(current_block() != NULL); 9926 DCHECK(current_block() != NULL);
9959 DCHECK(current_block()->HasPredecessor()); 9927 DCHECK(current_block()->HasPredecessor());
9960 switch (expr->op()) { 9928 switch (expr->op()) {
9961 case Token::DELETE: return VisitDelete(expr); 9929 case Token::DELETE: return VisitDelete(expr);
(...skipping 3474 matching lines...) Expand 10 before | Expand all | Expand 10 after
13436 if (ShouldProduceTraceOutput()) { 13404 if (ShouldProduceTraceOutput()) {
13437 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); 13405 isolate()->GetHTracer()->TraceHydrogen(name(), graph_);
13438 } 13406 }
13439 13407
13440 #ifdef DEBUG 13408 #ifdef DEBUG
13441 graph_->Verify(false); // No full verify. 13409 graph_->Verify(false); // No full verify.
13442 #endif 13410 #endif
13443 } 13411 }
13444 13412
13445 } } // namespace v8::internal 13413 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698