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

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

Issue 362004: Remove the typeof state threaded through the code generator. It was... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 1 month 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/arm/codegen-arm-inl.h ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 bool is_illegal() const { return type_ == ILLEGAL; } 70 bool is_illegal() const { return type_ == ILLEGAL; }
71 bool is_slot() const { return type_ == SLOT; } 71 bool is_slot() const { return type_ == SLOT; }
72 bool is_property() const { return type_ == NAMED || type_ == KEYED; } 72 bool is_property() const { return type_ == NAMED || type_ == KEYED; }
73 73
74 // Return the name. Only valid for named property references. 74 // Return the name. Only valid for named property references.
75 Handle<String> GetName(); 75 Handle<String> GetName();
76 76
77 // Generate code to push the value of the reference on top of the 77 // Generate code to push the value of the reference on top of the
78 // expression stack. The reference is expected to be already on top of 78 // expression stack. The reference is expected to be already on top of
79 // the expression stack, and it is left in place with its value above it. 79 // the expression stack, and it is left in place with its value above it.
80 void GetValue(TypeofState typeof_state); 80 void GetValue();
81 81
82 // Like GetValue except that the slot is expected to be written to before 82 // Like GetValue except that the slot is expected to be written to before
83 // being read from again. Thae value of the reference may be invalidated, 83 // being read from again. Thae value of the reference may be invalidated,
84 // causing subsequent attempts to read it to fail. 84 // causing subsequent attempts to read it to fail.
85 void TakeValue(TypeofState typeof_state); 85 void TakeValue();
86 86
87 // Generate code to store the value on top of the expression stack in the 87 // Generate code to store the value on top of the expression stack in the
88 // reference. The reference is expected to be immediately below the value 88 // reference. The reference is expected to be immediately below the value
89 // on the expression stack. The stored value is left in place (with the 89 // on the expression stack. The stored value is left in place (with the
90 // reference intact below it) to support chained assignments. 90 // reference intact below it) to support chained assignments.
91 void SetValue(InitState init_state); 91 void SetValue(InitState init_state);
92 92
93 private: 93 private:
94 CodeGenerator* cgen_; 94 CodeGenerator* cgen_;
95 Expression* expression_; 95 Expression* expression_;
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // The code generator state is only used for expressions, so statements have 234 // The code generator state is only used for expressions, so statements have
235 // the initial state. 235 // the initial state.
236 236
237 class CodeGenState BASE_EMBEDDED { 237 class CodeGenState BASE_EMBEDDED {
238 public: 238 public:
239 // Create an initial code generator state. Destroying the initial state 239 // Create an initial code generator state. Destroying the initial state
240 // leaves the code generator with a NULL state. 240 // leaves the code generator with a NULL state.
241 explicit CodeGenState(CodeGenerator* owner); 241 explicit CodeGenState(CodeGenerator* owner);
242 242
243 // Create a code generator state based on a code generator's current 243 // Create a code generator state based on a code generator's current
244 // state. The new state may or may not be inside a typeof, and has its 244 // state. The new state has its own control destination.
245 // own control destination. 245 CodeGenState(CodeGenerator* owner, ControlDestination* destination);
246 CodeGenState(CodeGenerator* owner,
247 TypeofState typeof_state,
248 ControlDestination* destination);
249 246
250 // Destroy a code generator state and restore the owning code generator's 247 // Destroy a code generator state and restore the owning code generator's
251 // previous state. 248 // previous state.
252 ~CodeGenState(); 249 ~CodeGenState();
253 250
254 // Accessors for the state. 251 // Accessors for the state.
255 TypeofState typeof_state() const { return typeof_state_; }
256 ControlDestination* destination() const { return destination_; } 252 ControlDestination* destination() const { return destination_; }
257 253
258 private: 254 private:
259 // The owning code generator. 255 // The owning code generator.
260 CodeGenerator* owner_; 256 CodeGenerator* owner_;
261 257
262 // A flag indicating whether we are compiling the immediate subexpression
263 // of a typeof expression.
264 TypeofState typeof_state_;
265
266 // A control destination in case the expression has a control-flow 258 // A control destination in case the expression has a control-flow
267 // effect. 259 // effect.
268 ControlDestination* destination_; 260 ControlDestination* destination_;
269 261
270 // The previous state of the owning code generator, restored when 262 // The previous state of the owning code generator, restored when
271 // this state is destroyed. 263 // this state is destroyed.
272 CodeGenState* previous_; 264 CodeGenState* previous_;
273 }; 265 };
274 266
275 267
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 virtual ~CodeGenerator() { delete masm_; } 337 virtual ~CodeGenerator() { delete masm_; }
346 338
347 // Accessors 339 // Accessors
348 Scope* scope() const { return scope_; } 340 Scope* scope() const { return scope_; }
349 bool is_eval() { return is_eval_; } 341 bool is_eval() { return is_eval_; }
350 342
351 // Generating deferred code. 343 // Generating deferred code.
352 void ProcessDeferred(); 344 void ProcessDeferred();
353 345
354 // State 346 // State
355 TypeofState typeof_state() const { return state_->typeof_state(); }
356 ControlDestination* destination() const { return state_->destination(); } 347 ControlDestination* destination() const { return state_->destination(); }
357 348
358 // Track loop nesting level. 349 // Track loop nesting level.
359 int loop_nesting() const { return loop_nesting_; } 350 int loop_nesting() const { return loop_nesting_; }
360 void IncrementLoopNesting() { loop_nesting_++; } 351 void IncrementLoopNesting() { loop_nesting_++; }
361 void DecrementLoopNesting() { loop_nesting_--; } 352 void DecrementLoopNesting() { loop_nesting_--; }
362 353
363 // Node visitors. 354 // Node visitors.
364 void VisitStatements(ZoneList<Statement*>* statements); 355 void VisitStatements(ZoneList<Statement*>* statements);
365 356
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 Operand ContextSlotOperandCheckExtensions(Slot* slot, 396 Operand ContextSlotOperandCheckExtensions(Slot* slot,
406 Result tmp, 397 Result tmp,
407 JumpTarget* slow); 398 JumpTarget* slow);
408 399
409 // Expressions 400 // Expressions
410 static Operand GlobalObject() { 401 static Operand GlobalObject() {
411 return ContextOperand(esi, Context::GLOBAL_INDEX); 402 return ContextOperand(esi, Context::GLOBAL_INDEX);
412 } 403 }
413 404
414 void LoadCondition(Expression* x, 405 void LoadCondition(Expression* x,
415 TypeofState typeof_state,
416 ControlDestination* destination, 406 ControlDestination* destination,
417 bool force_control); 407 bool force_control);
418 void Load(Expression* x, TypeofState typeof_state = NOT_INSIDE_TYPEOF); 408 void Load(Expression* expr);
419 void LoadGlobal(); 409 void LoadGlobal();
420 void LoadGlobalReceiver(); 410 void LoadGlobalReceiver();
421 411
422 // Generate code to push the value of an expression on top of the frame 412 // Generate code to push the value of an expression on top of the frame
423 // and then spill the frame fully to memory. This function is used 413 // and then spill the frame fully to memory. This function is used
424 // temporarily while the code generator is being transformed. 414 // temporarily while the code generator is being transformed.
425 void LoadAndSpill(Expression* expression, 415 void LoadAndSpill(Expression* expression);
426 TypeofState typeof_state = NOT_INSIDE_TYPEOF);
427 416
428 // Read a value from a slot and leave it on top of the expression stack. 417 // Read a value from a slot and leave it on top of the expression stack.
429 void LoadFromSlot(Slot* slot, TypeofState typeof_state); 418 void LoadFromSlot(Slot* slot, TypeofState typeof_state);
430 void LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state); 419 void LoadFromSlotCheckForArguments(Slot* slot, TypeofState typeof_state);
431 Result LoadFromGlobalSlotCheckExtensions(Slot* slot, 420 Result LoadFromGlobalSlotCheckExtensions(Slot* slot,
432 TypeofState typeof_state, 421 TypeofState typeof_state,
433 JumpTarget* slow); 422 JumpTarget* slow);
434 423
435 // Store the value on top of the expression stack into a slot, leaving the 424 // Store the value on top of the expression stack into a slot, leaving the
436 // value in place. 425 // value in place.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 void SetArgsReversed() { args_reversed_ = true; } 735 void SetArgsReversed() { args_reversed_ = true; }
747 bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; } 736 bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; }
748 bool HasArgumentsInRegisters() { return args_in_registers_; } 737 bool HasArgumentsInRegisters() { return args_in_registers_; }
749 bool HasArgumentsReversed() { return args_reversed_; } 738 bool HasArgumentsReversed() { return args_reversed_; }
750 }; 739 };
751 740
752 741
753 } } // namespace v8::internal 742 } } // namespace v8::internal
754 743
755 #endif // V8_IA32_CODEGEN_IA32_H_ 744 #endif // V8_IA32_CODEGEN_IA32_H_
OLDNEW
« no previous file with comments | « src/arm/codegen-arm-inl.h ('k') | src/ia32/codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698