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

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

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 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/frames.cc ('k') | src/full-codegen.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 : expr_(expr), parent_(parent) { } 267 : expr_(expr), parent_(parent) { }
268 268
269 Expression* expr() const { return expr_; } 269 Expression* expr() const { return expr_; }
270 ForwardBailoutStack* parent() const { return parent_; } 270 ForwardBailoutStack* parent() const { return parent_; }
271 271
272 private: 272 private:
273 Expression* const expr_; 273 Expression* const expr_;
274 ForwardBailoutStack* const parent_; 274 ForwardBailoutStack* const parent_;
275 }; 275 };
276 276
277 enum ConstantOperand {
278 kNoConstants,
279 kLeftConstant,
280 kRightConstant
281 };
282
283 // Type of a member function that generates inline code for a native function. 277 // Type of a member function that generates inline code for a native function.
284 typedef void (FullCodeGenerator::*InlineFunctionGenerator) 278 typedef void (FullCodeGenerator::*InlineFunctionGenerator)
285 (ZoneList<Expression*>*); 279 (ZoneList<Expression*>*);
286 280
287 static const InlineFunctionGenerator kInlineFunctionGenerators[]; 281 static const InlineFunctionGenerator kInlineFunctionGenerators[];
288 282
289 // A platform-specific utility to overwrite the accumulator register 283 // A platform-specific utility to overwrite the accumulator register
290 // with a GC-safe value. 284 // with a GC-safe value.
291 void ClearAccumulator(); 285 void ClearAccumulator();
292 286
293 // Compute the frame pointer relative offset for a given local or 287 // Compute the frame pointer relative offset for a given local or
294 // parameter slot. 288 // parameter slot.
295 int SlotOffset(Slot* slot); 289 int SlotOffset(Slot* slot);
296 290
297 // Determine whether or not to inline the smi case for the given 291 // Determine whether or not to inline the smi case for the given
298 // operation. 292 // operation.
299 bool ShouldInlineSmiCase(Token::Value op); 293 bool ShouldInlineSmiCase(Token::Value op);
300 294
301 // Compute which (if any) of the operands is a compile-time constant.
302 ConstantOperand GetConstantOperand(Token::Value op,
303 Expression* left,
304 Expression* right);
305
306 // Helper function to convert a pure value into a test context. The value 295 // Helper function to convert a pure value into a test context. The value
307 // is expected on the stack or the accumulator, depending on the platform. 296 // is expected on the stack or the accumulator, depending on the platform.
308 // See the platform-specific implementation for details. 297 // See the platform-specific implementation for details.
309 void DoTest(Label* if_true, Label* if_false, Label* fall_through); 298 void DoTest(Label* if_true, Label* if_false, Label* fall_through);
310 299
311 // Helper function to split control flow and avoid a branch to the 300 // Helper function to split control flow and avoid a branch to the
312 // fall-through label if it is set up. 301 // fall-through label if it is set up.
313 void Split(Condition cc, 302 void Split(Condition cc,
314 Label* if_true, 303 Label* if_true,
315 Label* if_false, 304 Label* if_false,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 void EmitLoadGlobalSlotCheckExtensions(Slot* slot, 414 void EmitLoadGlobalSlotCheckExtensions(Slot* slot,
426 TypeofState typeof_state, 415 TypeofState typeof_state,
427 Label* slow); 416 Label* slow);
428 MemOperand ContextSlotOperandCheckExtensions(Slot* slot, Label* slow); 417 MemOperand ContextSlotOperandCheckExtensions(Slot* slot, Label* slow);
429 void EmitDynamicLoadFromSlotFastCase(Slot* slot, 418 void EmitDynamicLoadFromSlotFastCase(Slot* slot,
430 TypeofState typeof_state, 419 TypeofState typeof_state,
431 Label* slow, 420 Label* slow,
432 Label* done); 421 Label* done);
433 void EmitVariableLoad(Variable* expr); 422 void EmitVariableLoad(Variable* expr);
434 423
424 enum ResolveEvalFlag {
425 SKIP_CONTEXT_LOOKUP,
426 PERFORM_CONTEXT_LOOKUP
427 };
428
429 // Expects the arguments and the function already pushed.
430 void EmitResolvePossiblyDirectEval(ResolveEvalFlag flag, int arg_count);
431
435 // Platform-specific support for allocating a new closure based on 432 // Platform-specific support for allocating a new closure based on
436 // the given function info. 433 // the given function info.
437 void EmitNewClosure(Handle<SharedFunctionInfo> info, bool pretenure); 434 void EmitNewClosure(Handle<SharedFunctionInfo> info, bool pretenure);
438 435
439 // Platform-specific support for compiling assignments. 436 // Platform-specific support for compiling assignments.
440 437
441 // Load a value from a named property. 438 // Load a value from a named property.
442 // The receiver is left on the stack by the IC. 439 // The receiver is left on the stack by the IC.
443 void EmitNamedPropertyLoad(Property* expr); 440 void EmitNamedPropertyLoad(Property* expr);
444 441
445 // Load a value from a keyed property. 442 // Load a value from a keyed property.
446 // The receiver and the key is left on the stack by the IC. 443 // The receiver and the key is left on the stack by the IC.
447 void EmitKeyedPropertyLoad(Property* expr); 444 void EmitKeyedPropertyLoad(Property* expr);
448 445
449 // Apply the compound assignment operator. Expects the left operand on top 446 // Apply the compound assignment operator. Expects the left operand on top
450 // of the stack and the right one in the accumulator. 447 // of the stack and the right one in the accumulator.
451 void EmitBinaryOp(Token::Value op, 448 void EmitBinaryOp(Token::Value op,
452 OverwriteMode mode); 449 OverwriteMode mode);
453 450
454 // Helper functions for generating inlined smi code for certain 451 // Helper functions for generating inlined smi code for certain
455 // binary operations. 452 // binary operations.
456 void EmitInlineSmiBinaryOp(Expression* expr, 453 void EmitInlineSmiBinaryOp(Expression* expr,
457 Token::Value op, 454 Token::Value op,
458 OverwriteMode mode, 455 OverwriteMode mode,
459 Expression* left, 456 Expression* left,
460 Expression* right, 457 Expression* right);
461 ConstantOperand constant);
462
463 void EmitConstantSmiBinaryOp(Expression* expr,
464 Token::Value op,
465 OverwriteMode mode,
466 bool left_is_constant_smi,
467 Smi* value);
468
469 void EmitConstantSmiBitOp(Expression* expr,
470 Token::Value op,
471 OverwriteMode mode,
472 Smi* value);
473
474 void EmitConstantSmiShiftOp(Expression* expr,
475 Token::Value op,
476 OverwriteMode mode,
477 Smi* value);
478
479 void EmitConstantSmiAdd(Expression* expr,
480 OverwriteMode mode,
481 bool left_is_constant_smi,
482 Smi* value);
483
484 void EmitConstantSmiSub(Expression* expr,
485 OverwriteMode mode,
486 bool left_is_constant_smi,
487 Smi* value);
488 458
489 // Assign to the given expression as if via '='. The right-hand-side value 459 // Assign to the given expression as if via '='. The right-hand-side value
490 // is expected in the accumulator. 460 // is expected in the accumulator.
491 void EmitAssignment(Expression* expr, int bailout_ast_id); 461 void EmitAssignment(Expression* expr, int bailout_ast_id);
492 462
493 // Complete a variable assignment. The right-hand-side value is expected 463 // Complete a variable assignment. The right-hand-side value is expected
494 // in the accumulator. 464 // in the accumulator.
495 void EmitVariableAssignment(Variable* var, 465 void EmitVariableAssignment(Variable* var,
496 Token::Value op); 466 Token::Value op);
497 467
(...skipping 26 matching lines...) Expand all
524 } 494 }
525 495
526 MacroAssembler* masm() { return masm_; } 496 MacroAssembler* masm() { return masm_; }
527 497
528 class ExpressionContext; 498 class ExpressionContext;
529 const ExpressionContext* context() { return context_; } 499 const ExpressionContext* context() { return context_; }
530 void set_new_context(const ExpressionContext* context) { context_ = context; } 500 void set_new_context(const ExpressionContext* context) { context_ = context; }
531 501
532 Handle<Script> script() { return info_->script(); } 502 Handle<Script> script() { return info_->script(); }
533 bool is_eval() { return info_->is_eval(); } 503 bool is_eval() { return info_->is_eval(); }
534 bool is_strict() { return function()->strict_mode(); } 504 bool is_strict_mode() { return function()->strict_mode(); }
535 StrictModeFlag strict_mode_flag() { 505 StrictModeFlag strict_mode_flag() {
536 return is_strict() ? kStrictMode : kNonStrictMode; 506 return is_strict_mode() ? kStrictMode : kNonStrictMode;
537 } 507 }
538 FunctionLiteral* function() { return info_->function(); } 508 FunctionLiteral* function() { return info_->function(); }
539 Scope* scope() { return info_->scope(); } 509 Scope* scope() { return info_->scope(); }
540 510
541 static Register result_register(); 511 static Register result_register();
542 static Register context_register(); 512 static Register context_register();
543 513
544 // Helper for calling an IC stub. 514 // Helper for calling an IC stub.
545 void EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode); 515 void EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode);
546 516
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 742
773 friend class NestedStatement; 743 friend class NestedStatement;
774 744
775 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator); 745 DISALLOW_COPY_AND_ASSIGN(FullCodeGenerator);
776 }; 746 };
777 747
778 748
779 } } // namespace v8::internal 749 } } // namespace v8::internal
780 750
781 #endif // V8_FULL_CODEGEN_H_ 751 #endif // V8_FULL_CODEGEN_H_
OLDNEW
« no previous file with comments | « src/frames.cc ('k') | src/full-codegen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698