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

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

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

Powered by Google App Engine
This is Rietveld 408576698