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

Side by Side Diff: src/ia32/virtual-frame-ia32.h

Issue 975001: Use untagged int32 values in evaluation of side-effect free expressions. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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/ia32/register-allocator-ia32.cc ('k') | src/ia32/virtual-frame-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 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 ASSERT(0 <= index); 235 ASSERT(0 <= index);
236 ASSERT(index < local_count()); 236 ASSERT(index < local_count());
237 return Operand(ebp, kLocal0Offset - index * kPointerSize); 237 return Operand(ebp, kLocal0Offset - index * kPointerSize);
238 } 238 }
239 239
240 // Push a copy of the value of a local frame slot on top of the frame. 240 // Push a copy of the value of a local frame slot on top of the frame.
241 void PushLocalAt(int index) { 241 void PushLocalAt(int index) {
242 PushFrameSlotAt(local0_index() + index); 242 PushFrameSlotAt(local0_index() + index);
243 } 243 }
244 244
245 // Push a copy of the value of a local frame slot on top of the frame.
246 void UntaggedPushLocalAt(int index) {
247 UntaggedPushFrameSlotAt(local0_index() + index);
248 }
249
245 // Push the value of a local frame slot on top of the frame and invalidate 250 // Push the value of a local frame slot on top of the frame and invalidate
246 // the local slot. The slot should be written to before trying to read 251 // the local slot. The slot should be written to before trying to read
247 // from it again. 252 // from it again.
248 void TakeLocalAt(int index) { 253 void TakeLocalAt(int index) {
249 TakeFrameSlotAt(local0_index() + index); 254 TakeFrameSlotAt(local0_index() + index);
250 } 255 }
251 256
252 // Store the top value on the virtual frame into a local frame slot. The 257 // Store the top value on the virtual frame into a local frame slot. The
253 // value is left in place on top of the frame. 258 // value is left in place on top of the frame.
254 void StoreToLocalAt(int index) { 259 void StoreToLocalAt(int index) {
(...skipping 20 matching lines...) Expand all
275 ASSERT(-1 <= index); // -1 is the receiver. 280 ASSERT(-1 <= index); // -1 is the receiver.
276 ASSERT(index < parameter_count()); 281 ASSERT(index < parameter_count());
277 return Operand(ebp, (1 + parameter_count() - index) * kPointerSize); 282 return Operand(ebp, (1 + parameter_count() - index) * kPointerSize);
278 } 283 }
279 284
280 // Push a copy of the value of a parameter frame slot on top of the frame. 285 // Push a copy of the value of a parameter frame slot on top of the frame.
281 void PushParameterAt(int index) { 286 void PushParameterAt(int index) {
282 PushFrameSlotAt(param0_index() + index); 287 PushFrameSlotAt(param0_index() + index);
283 } 288 }
284 289
290 // Push a copy of the value of a parameter frame slot on top of the frame.
291 void UntaggedPushParameterAt(int index) {
292 UntaggedPushFrameSlotAt(param0_index() + index);
293 }
294
285 // Push the value of a paramter frame slot on top of the frame and 295 // Push the value of a paramter frame slot on top of the frame and
286 // invalidate the parameter slot. The slot should be written to before 296 // invalidate the parameter slot. The slot should be written to before
287 // trying to read from it again. 297 // trying to read from it again.
288 void TakeParameterAt(int index) { 298 void TakeParameterAt(int index) {
289 TakeFrameSlotAt(param0_index() + index); 299 TakeFrameSlotAt(param0_index() + index);
290 } 300 }
291 301
292 // Store the top value on the virtual frame into a parameter frame slot. 302 // Store the top value on the virtual frame into a parameter frame slot.
293 // The value is left in place on top of the frame. 303 // The value is left in place on top of the frame.
294 void StoreToParameterAt(int index) { 304 void StoreToParameterAt(int index) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 void EmitPush(Operand operand, 402 void EmitPush(Operand operand,
393 NumberInfo info = NumberInfo::Unknown()); 403 NumberInfo info = NumberInfo::Unknown());
394 void EmitPush(Immediate immediate, 404 void EmitPush(Immediate immediate,
395 NumberInfo info = NumberInfo::Unknown()); 405 NumberInfo info = NumberInfo::Unknown());
396 406
397 // Push an element on the virtual frame. 407 // Push an element on the virtual frame.
398 inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown()); 408 inline void Push(Register reg, NumberInfo info = NumberInfo::Unknown());
399 inline void Push(Handle<Object> value); 409 inline void Push(Handle<Object> value);
400 inline void Push(Smi* value); 410 inline void Push(Smi* value);
401 411
412 void PushUntaggedElement(Handle<Object> value);
413
402 // Pushing a result invalidates it (its contents become owned by the 414 // Pushing a result invalidates it (its contents become owned by the
403 // frame). 415 // frame).
404 void Push(Result* result) { 416 void Push(Result* result) {
405 // This assert will trigger if you try to push the same value twice. 417 // This assert will trigger if you try to push the same value twice.
406 ASSERT(result->is_valid()); 418 ASSERT(result->is_valid());
407 if (result->is_register()) { 419 if (result->is_register()) {
408 Push(result->reg(), result->number_info()); 420 Push(result->reg(), result->number_info());
409 } else { 421 } else {
410 ASSERT(result->is_constant()); 422 ASSERT(result->is_constant());
411 Push(result->handle()); 423 Push(result->handle());
412 } 424 }
425 if (cgen()->in_safe_int32_mode()) {
426 ASSERT(result->is_untagged_int32());
427 elements_[element_count() - 1].set_untagged_int32(true);
428 }
413 result->Unuse(); 429 result->Unuse();
414 } 430 }
415 431
416 // Pushing an expression expects that the expression is trivial (according 432 // Pushing an expression expects that the expression is trivial (according
417 // to Expression::IsTrivial). 433 // to Expression::IsTrivial).
418 void Push(Expression* expr); 434 void Push(Expression* expr);
419 435
420 // Nip removes zero or more elements from immediately below the top 436 // Nip removes zero or more elements from immediately below the top
421 // of the frame, leaving the previous top-of-frame value on top of 437 // of the frame, leaving the previous top-of-frame value on top of
422 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x). 438 // the frame. Nip(k) is equivalent to x = Pop(), Drop(k), Push(x).
423 inline void Nip(int num_dropped); 439 inline void Nip(int num_dropped);
424 440
441 // Check that the frame has no elements containing untagged int32 elements.
442 bool HasNoUntaggedInt32Elements() {
443 for (int i = 0; i < element_count(); ++i) {
444 if (elements_[i].is_untagged_int32()) return false;
445 }
446 return true;
447 }
448
425 // Update the type information of a local variable frame element directly. 449 // Update the type information of a local variable frame element directly.
426 inline void SetTypeForLocalAt(int index, NumberInfo info); 450 inline void SetTypeForLocalAt(int index, NumberInfo info);
427 451
428 private: 452 private:
429 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset; 453 static const int kLocal0Offset = JavaScriptFrameConstants::kLocal0Offset;
430 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset; 454 static const int kFunctionOffset = JavaScriptFrameConstants::kFunctionOffset;
431 static const int kContextOffset = StandardFrameConstants::kContextOffset; 455 static const int kContextOffset = StandardFrameConstants::kContextOffset;
432 456
433 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize; 457 static const int kHandlerSize = StackHandlerConstants::kSize / kPointerSize;
434 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots. 458 static const int kPreallocatedElements = 5 + 8; // 8 expression stack slots.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 // Sync a single unsynced element that lies beneath or at the stack pointer. 550 // Sync a single unsynced element that lies beneath or at the stack pointer.
527 void SyncElementBelowStackPointer(int index); 551 void SyncElementBelowStackPointer(int index);
528 552
529 // Sync a single unsynced element that lies just above the stack pointer. 553 // Sync a single unsynced element that lies just above the stack pointer.
530 void SyncElementByPushing(int index); 554 void SyncElementByPushing(int index);
531 555
532 // Push a copy of a frame slot (typically a local or parameter) on top of 556 // Push a copy of a frame slot (typically a local or parameter) on top of
533 // the frame. 557 // the frame.
534 inline void PushFrameSlotAt(int index); 558 inline void PushFrameSlotAt(int index);
535 559
560 // Push a copy of a frame slot (typically a local or parameter) on top of
561 // the frame, at an untagged int32 value. Bails out if the value is not
562 // an int32.
563 void UntaggedPushFrameSlotAt(int index);
564
536 // Push a the value of a frame slot (typically a local or parameter) on 565 // Push a the value of a frame slot (typically a local or parameter) on
537 // top of the frame and invalidate the slot. 566 // top of the frame and invalidate the slot.
538 void TakeFrameSlotAt(int index); 567 void TakeFrameSlotAt(int index);
539 568
540 // Store the value on top of the frame to a frame slot (typically a local 569 // Store the value on top of the frame to a frame slot (typically a local
541 // or parameter). 570 // or parameter).
542 void StoreToFrameSlotAt(int index); 571 void StoreToFrameSlotAt(int index);
543 572
544 // Spill all elements in registers. Spill the top spilled_args elements 573 // Spill all elements in registers. Spill the top spilled_args elements
545 // on the frame. Sync all other frame elements. 574 // on the frame. Sync all other frame elements.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 inline bool Equals(VirtualFrame* other); 622 inline bool Equals(VirtualFrame* other);
594 623
595 // Classes that need raw access to the elements_ array. 624 // Classes that need raw access to the elements_ array.
596 friend class DeferredCode; 625 friend class DeferredCode;
597 friend class JumpTarget; 626 friend class JumpTarget;
598 }; 627 };
599 628
600 } } // namespace v8::internal 629 } } // namespace v8::internal
601 630
602 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_ 631 #endif // V8_IA32_VIRTUAL_FRAME_IA32_H_
OLDNEW
« no previous file with comments | « src/ia32/register-allocator-ia32.cc ('k') | src/ia32/virtual-frame-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698