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

Side by Side Diff: src/full-codegen.cc

Issue 3421009: Revision 2.4.4.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 3 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/full-codegen.h ('k') | src/global-handles.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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 break; 317 break;
318 case Slot::CONTEXT: 318 case Slot::CONTEXT:
319 case Slot::LOOKUP: 319 case Slot::LOOKUP:
320 UNREACHABLE(); 320 UNREACHABLE();
321 } 321 }
322 return offset; 322 return offset;
323 } 323 }
324 324
325 325
326 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) { 326 bool FullCodeGenerator::ShouldInlineSmiCase(Token::Value op) {
327 // TODO(kasperl): Once the compare stub allows leaving out the
328 // inlined smi case, we should get rid of this check.
329 if (Token::IsCompareOp(op)) return true;
330 // TODO(kasperl): Once the unary bit not stub allows leaving out
331 // the inlined smi case, we should get rid of this check.
332 if (op == Token::BIT_NOT) return true;
333 // Inline smi case inside loops, but not division and modulo which 327 // Inline smi case inside loops, but not division and modulo which
334 // are too complicated and take up too much space. 328 // are too complicated and take up too much space.
335 return (op != Token::DIV) && (op != Token::MOD) && (loop_depth_ > 0); 329 if (op == Token::DIV ||op == Token::MOD) return false;
330 if (FLAG_always_inline_smi_code) return true;
331 return loop_depth_ > 0;
336 } 332 }
337 333
338 334
339 void FullCodeGenerator::PrepareTest(Label* materialize_true, 335 void FullCodeGenerator::PrepareTest(Label* materialize_true,
340 Label* materialize_false, 336 Label* materialize_false,
341 Label** if_true, 337 Label** if_true,
342 Label** if_false, 338 Label** if_false,
343 Label** fall_through) { 339 Label** fall_through) {
344 switch (context_) { 340 switch (context_) {
345 case Expression::kUninitialized: 341 case Expression::kUninitialized:
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 } 494 }
499 495
500 496
501 void FullCodeGenerator::SetSourcePosition(int pos) { 497 void FullCodeGenerator::SetSourcePosition(int pos) {
502 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) { 498 if (FLAG_debug_info && pos != RelocInfo::kNoPosition) {
503 masm_->RecordPosition(pos); 499 masm_->RecordPosition(pos);
504 } 500 }
505 } 501 }
506 502
507 503
508 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* expr) { 504 // Lookup table for code generators for special runtime calls which are
509 Handle<String> name = expr->name(); 505 // generated inline.
510 SmartPointer<char> cstring = name->ToCString(); 506 #define INLINE_FUNCTION_GENERATOR_ADDRESS(Name, argc, ressize) \
507 &FullCodeGenerator::Emit##Name,
511 508
512 #define CHECK_EMIT_INLINE_CALL(name, x, y) \ 509 const FullCodeGenerator::InlineFunctionGenerator
513 if (strcmp("_"#name, *cstring) == 0) { \ 510 FullCodeGenerator::kInlineFunctionGenerators[] = {
514 Emit##name(expr->arguments()); \ 511 INLINE_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
515 return; \ 512 INLINE_RUNTIME_FUNCTION_LIST(INLINE_FUNCTION_GENERATOR_ADDRESS)
516 } 513 };
517 INLINE_RUNTIME_FUNCTION_LIST(CHECK_EMIT_INLINE_CALL) 514 #undef INLINE_FUNCTION_GENERATOR_ADDRESS
518 #undef CHECK_EMIT_INLINE_CALL 515
519 UNREACHABLE(); 516
517 FullCodeGenerator::InlineFunctionGenerator
518 FullCodeGenerator::FindInlineFunctionGenerator(Runtime::FunctionId id) {
519 return kInlineFunctionGenerators[
520 static_cast<int>(id) - static_cast<int>(Runtime::kFirstInlineFunction)];
521 }
522
523
524 void FullCodeGenerator::EmitInlineRuntimeCall(CallRuntime* node) {
525 ZoneList<Expression*>* args = node->arguments();
526 Handle<String> name = node->name();
527 Runtime::Function* function = node->function();
528 ASSERT(function != NULL);
529 ASSERT(function->intrinsic_type == Runtime::INLINE);
530 InlineFunctionGenerator generator =
531 FindInlineFunctionGenerator(function->function_id);
532 ASSERT(generator != NULL);
533 ((*this).*(generator))(args);
520 } 534 }
521 535
522 536
523 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { 537 void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
524 Comment cmnt(masm_, "[ BinaryOperation"); 538 Comment cmnt(masm_, "[ BinaryOperation");
525 Token::Value op = expr->op(); 539 Token::Value op = expr->op();
526 Expression* left = expr->left(); 540 Expression* left = expr->left();
527 Expression* right = expr->right(); 541 Expression* right = expr->right();
528 542
529 OverwriteMode mode = NO_OVERWRITE; 543 OverwriteMode mode = NO_OVERWRITE;
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 ASSERT(args->length() == 1); 1152 ASSERT(args->length() == 1);
1139 VisitForValue(args->at(0), kStack); 1153 VisitForValue(args->at(0), kStack);
1140 __ CallRuntime(Runtime::kRegExpCloneResult, 1); 1154 __ CallRuntime(Runtime::kRegExpCloneResult, 1);
1141 Apply(context_, result_register()); 1155 Apply(context_, result_register());
1142 } 1156 }
1143 1157
1144 #undef __ 1158 #undef __
1145 1159
1146 1160
1147 } } // namespace v8::internal 1161 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/full-codegen.h ('k') | src/global-handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698