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

Side by Side Diff: src/x64/codegen-x64.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/ia32/codegen-ia32.cc ('k') | src/x64/codegen-x64.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 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 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 338
347 // Accessors 339 // Accessors
348 Scope* scope() const { return scope_; } 340 Scope* scope() const { return scope_; }
349 341
350 // Generating deferred code. 342 // Generating deferred code.
351 void ProcessDeferred(); 343 void ProcessDeferred();
352 344
353 bool is_eval() { return is_eval_; } 345 bool is_eval() { return is_eval_; }
354 346
355 // State 347 // State
356 TypeofState typeof_state() const { return state_->typeof_state(); }
357 ControlDestination* destination() const { return state_->destination(); } 348 ControlDestination* destination() const { return state_->destination(); }
358 349
359 // Track loop nesting level. 350 // Track loop nesting level.
360 int loop_nesting() const { return loop_nesting_; } 351 int loop_nesting() const { return loop_nesting_; }
361 void IncrementLoopNesting() { loop_nesting_++; } 352 void IncrementLoopNesting() { loop_nesting_++; }
362 void DecrementLoopNesting() { loop_nesting_--; } 353 void DecrementLoopNesting() { loop_nesting_--; }
363 354
364 355
365 // Node visitors. 356 // Node visitors.
366 void VisitStatements(ZoneList<Statement*>* statements); 357 void VisitStatements(ZoneList<Statement*>* statements);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 Operand ContextSlotOperandCheckExtensions(Slot* slot, 398 Operand ContextSlotOperandCheckExtensions(Slot* slot,
408 Result tmp, 399 Result tmp,
409 JumpTarget* slow); 400 JumpTarget* slow);
410 401
411 // Expressions 402 // Expressions
412 static Operand GlobalObject() { 403 static Operand GlobalObject() {
413 return ContextOperand(rsi, Context::GLOBAL_INDEX); 404 return ContextOperand(rsi, Context::GLOBAL_INDEX);
414 } 405 }
415 406
416 void LoadCondition(Expression* x, 407 void LoadCondition(Expression* x,
417 TypeofState typeof_state,
418 ControlDestination* destination, 408 ControlDestination* destination,
419 bool force_control); 409 bool force_control);
420 void Load(Expression* x, TypeofState typeof_state = NOT_INSIDE_TYPEOF); 410 void Load(Expression* expr);
421 void LoadGlobal(); 411 void LoadGlobal();
422 void LoadGlobalReceiver(); 412 void LoadGlobalReceiver();
423 413
424 // Generate code to push the value of an expression on top of the frame 414 // Generate code to push the value of an expression on top of the frame
425 // and then spill the frame fully to memory. This function is used 415 // and then spill the frame fully to memory. This function is used
426 // temporarily while the code generator is being transformed. 416 // temporarily while the code generator is being transformed.
427 void LoadAndSpill(Expression* expression, 417 void LoadAndSpill(Expression* expression);
428 TypeofState typeof_state = NOT_INSIDE_TYPEOF);
429 418
430 // Read a value from a slot and leave it on top of the expression stack. 419 // Read a value from a slot and leave it on top of the expression stack.
431 void LoadFromSlot(Slot* slot, TypeofState typeof_state); 420 void LoadFromSlot(Slot* slot, TypeofState typeof_state);
432 void LoadFromSlotCheckForArguments(Slot* slot, TypeofState state); 421 void LoadFromSlotCheckForArguments(Slot* slot, TypeofState state);
433 Result LoadFromGlobalSlotCheckExtensions(Slot* slot, 422 Result LoadFromGlobalSlotCheckExtensions(Slot* slot,
434 TypeofState typeof_state, 423 TypeofState typeof_state,
435 JumpTarget* slow); 424 JumpTarget* slow);
436 425
437 // Store the value on top of the expression stack into a slot, leaving the 426 // Store the value on top of the expression stack into a slot, leaving the
438 // value in place. 427 // value in place.
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 void SetArgsReversed() { args_reversed_ = true; } 742 void SetArgsReversed() { args_reversed_ = true; }
754 bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; } 743 bool HasSmiCodeInStub() { return (flags_ & NO_SMI_CODE_IN_STUB) == 0; }
755 bool HasArgumentsInRegisters() { return args_in_registers_; } 744 bool HasArgumentsInRegisters() { return args_in_registers_; }
756 bool HasArgumentsReversed() { return args_reversed_; } 745 bool HasArgumentsReversed() { return args_reversed_; }
757 }; 746 };
758 747
759 748
760 } } // namespace v8::internal 749 } } // namespace v8::internal
761 750
762 #endif // V8_X64_CODEGEN_X64_H_ 751 #endif // V8_X64_CODEGEN_X64_H_
OLDNEW
« no previous file with comments | « src/ia32/codegen-ia32.cc ('k') | src/x64/codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698