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

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

Issue 566008: Incorporate the arguments to the code generator constructors and their (Closed)
Patch Set: Incorporate the arguments to the code generator constructors and their... Created 10 years, 10 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/handles.cc ('k') | src/ia32/codegen-ia32.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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 // compiler and needs to setup everything or the compiler is used as 298 // compiler and needs to setup everything or the compiler is used as
299 // the secondary compiler for split compilation and has to handle 299 // the secondary compiler for split compilation and has to handle
300 // bailouts. 300 // bailouts.
301 enum Mode { 301 enum Mode {
302 PRIMARY, 302 PRIMARY,
303 SECONDARY 303 SECONDARY
304 }; 304 };
305 305
306 // Takes a function literal, generates code for it. This function should only 306 // Takes a function literal, generates code for it. This function should only
307 // be called by compiler.cc. 307 // be called by compiler.cc.
308 static Handle<Code> MakeCode(FunctionLiteral* fun, 308 static Handle<Code> MakeCode(CompilationInfo* info);
309 Handle<Script> script,
310 bool is_eval,
311 CompilationInfo* info);
312 309
313 // Printing of AST, etc. as requested by flags. 310 // Printing of AST, etc. as requested by flags.
314 static void MakeCodePrologue(FunctionLiteral* fun); 311 static void MakeCodePrologue(CompilationInfo* info);
315 312
316 // Allocate and install the code. 313 // Allocate and install the code.
317 static Handle<Code> MakeCodeEpilogue(FunctionLiteral* fun, 314 static Handle<Code> MakeCodeEpilogue(MacroAssembler* masm,
318 MacroAssembler* masm,
319 Code::Flags flags, 315 Code::Flags flags,
320 Handle<Script> script); 316 CompilationInfo* info);
321 317
322 #ifdef ENABLE_LOGGING_AND_PROFILING 318 #ifdef ENABLE_LOGGING_AND_PROFILING
323 static bool ShouldGenerateLog(Expression* type); 319 static bool ShouldGenerateLog(Expression* type);
324 #endif 320 #endif
325 321
326 static void RecordPositions(MacroAssembler* masm, int pos); 322 static void RecordPositions(MacroAssembler* masm, int pos);
327 323
328 // Accessors 324 // Accessors
329 MacroAssembler* masm() { return masm_; } 325 MacroAssembler* masm() { return masm_; }
330 VirtualFrame* frame() const { return frame_; } 326 VirtualFrame* frame() const { return frame_; }
331 Handle<Script> script() { return script_; } 327 inline Handle<Script> script();
332 328
333 bool has_valid_frame() const { return frame_ != NULL; } 329 bool has_valid_frame() const { return frame_ != NULL; }
334 330
335 // Set the virtual frame to be new_frame, with non-frame register 331 // Set the virtual frame to be new_frame, with non-frame register
336 // reference counts given by non_frame_registers. The non-frame 332 // reference counts given by non_frame_registers. The non-frame
337 // register reference counts of the old frame are returned in 333 // register reference counts of the old frame are returned in
338 // non_frame_registers. 334 // non_frame_registers.
339 void SetFrame(VirtualFrame* new_frame, RegisterFile* non_frame_registers); 335 void SetFrame(VirtualFrame* new_frame, RegisterFile* non_frame_registers);
340 336
341 void DeleteFrame(); 337 void DeleteFrame();
342 338
343 RegisterAllocator* allocator() const { return allocator_; } 339 RegisterAllocator* allocator() const { return allocator_; }
344 340
345 CodeGenState* state() { return state_; } 341 CodeGenState* state() { return state_; }
346 void set_state(CodeGenState* state) { state_ = state; } 342 void set_state(CodeGenState* state) { state_ = state; }
347 343
348 void AddDeferred(DeferredCode* code) { deferred_.Add(code); } 344 void AddDeferred(DeferredCode* code) { deferred_.Add(code); }
349 345
350 bool in_spilled_code() const { return in_spilled_code_; } 346 bool in_spilled_code() const { return in_spilled_code_; }
351 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; } 347 void set_in_spilled_code(bool flag) { in_spilled_code_ = flag; }
352 348
353 private: 349 private:
354 // Construction/Destruction 350 // Construction/Destruction
355 CodeGenerator(MacroAssembler* masm, Handle<Script> script, bool is_eval); 351 CodeGenerator(MacroAssembler* masm);
356 352
357 // Accessors 353 // Accessors
358 Scope* scope() const { return scope_; } 354 inline bool is_eval();
359 bool is_eval() { return is_eval_; } 355 Scope* scope();
360 356
361 // Generating deferred code. 357 // Generating deferred code.
362 void ProcessDeferred(); 358 void ProcessDeferred();
363 359
364 // State 360 // State
365 ControlDestination* destination() const { return state_->destination(); } 361 ControlDestination* destination() const { return state_->destination(); }
366 362
367 // Track loop nesting level. 363 // Track loop nesting level.
368 int loop_nesting() const { return loop_nesting_; } 364 int loop_nesting() const { return loop_nesting_; }
369 void IncrementLoopNesting() { loop_nesting_++; } 365 void IncrementLoopNesting() { loop_nesting_++; }
(...skipping 11 matching lines...) Expand all
381 // reach the end of the statement (ie, it does not exit via break, 377 // reach the end of the statement (ie, it does not exit via break,
382 // continue, return, or throw). This function is used temporarily while 378 // continue, return, or throw). This function is used temporarily while
383 // the code generator is being transformed. 379 // the code generator is being transformed.
384 void VisitAndSpill(Statement* statement); 380 void VisitAndSpill(Statement* statement);
385 381
386 // Visit a list of statements and then spill the virtual frame if control 382 // Visit a list of statements and then spill the virtual frame if control
387 // flow can reach the end of the list. 383 // flow can reach the end of the list.
388 void VisitStatementsAndSpill(ZoneList<Statement*>* statements); 384 void VisitStatementsAndSpill(ZoneList<Statement*>* statements);
389 385
390 // Main code generation function 386 // Main code generation function
391 void Generate(FunctionLiteral* fun, Mode mode, CompilationInfo* info); 387 void Generate(CompilationInfo* info, Mode mode);
392 388
393 // Generate the return sequence code. Should be called no more than 389 // Generate the return sequence code. Should be called no more than
394 // once per compiled function, immediately after binding the return 390 // once per compiled function, immediately after binding the return
395 // target (which can not be done more than once). 391 // target (which can not be done more than once).
396 void GenerateReturnSequence(Result* return_value); 392 void GenerateReturnSequence(Result* return_value);
397 393
398 // Returns the arguments allocation mode. 394 // Returns the arguments allocation mode.
399 ArgumentsAllocationMode ArgumentsMode() const; 395 ArgumentsAllocationMode ArgumentsMode();
400 396
401 // Store the arguments object and allocate it if necessary. 397 // Store the arguments object and allocate it if necessary.
402 Result StoreArgumentsObject(bool initial); 398 Result StoreArgumentsObject(bool initial);
403 399
404 // The following are used by class Reference. 400 // The following are used by class Reference.
405 void LoadReference(Reference* ref); 401 void LoadReference(Reference* ref);
406 void UnloadReference(Reference* ref); 402 void UnloadReference(Reference* ref);
407 403
408 static Operand ContextOperand(Register context, int index) { 404 static Operand ContextOperand(Register context, int index) {
409 return Operand(context, Context::SlotOffset(index)); 405 return Operand(context, Context::SlotOffset(index));
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 void CodeForStatementPosition(Statement* stmt); 596 void CodeForStatementPosition(Statement* stmt);
601 void CodeForDoWhileConditionPosition(DoWhileStatement* stmt); 597 void CodeForDoWhileConditionPosition(DoWhileStatement* stmt);
602 void CodeForSourcePosition(int pos); 598 void CodeForSourcePosition(int pos);
603 599
604 #ifdef DEBUG 600 #ifdef DEBUG
605 // True if the registers are valid for entry to a block. There should 601 // True if the registers are valid for entry to a block. There should
606 // be no frame-external references to (non-reserved) registers. 602 // be no frame-external references to (non-reserved) registers.
607 bool HasValidEntryRegisters(); 603 bool HasValidEntryRegisters();
608 #endif 604 #endif
609 605
610 bool is_eval_; // Tells whether code is generated for eval.
611 Handle<Script> script_;
612 ZoneList<DeferredCode*> deferred_; 606 ZoneList<DeferredCode*> deferred_;
613 607
614 // Assembler 608 // Assembler
615 MacroAssembler* masm_; // to generate code 609 MacroAssembler* masm_; // to generate code
616 610
611 CompilationInfo* info_;
612
617 // Code generation state 613 // Code generation state
618 Scope* scope_;
619 VirtualFrame* frame_; 614 VirtualFrame* frame_;
620 RegisterAllocator* allocator_; 615 RegisterAllocator* allocator_;
621 CodeGenState* state_; 616 CodeGenState* state_;
622 int loop_nesting_; 617 int loop_nesting_;
623 618
624 // Jump targets. 619 // Jump targets.
625 // The target of the return from the function. 620 // The target of the return from the function.
626 BreakTarget function_return_; 621 BreakTarget function_return_;
627 622
628 // True if the function return is shadowed (ie, jumping to the target 623 // True if the function return is shadowed (ie, jumping to the target
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 Major MajorKey() { return StringCompare; } 824 Major MajorKey() { return StringCompare; }
830 int MinorKey() { return 0; } 825 int MinorKey() { return 0; }
831 826
832 void Generate(MacroAssembler* masm); 827 void Generate(MacroAssembler* masm);
833 }; 828 };
834 829
835 830
836 } } // namespace v8::internal 831 } } // namespace v8::internal
837 832
838 #endif // V8_IA32_CODEGEN_IA32_H_ 833 #endif // V8_IA32_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698