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

Side by Side Diff: src/objects-inl.h

Issue 6606002: Merge revision 6500-6600 from bleeding_edge to the isolates branch. (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
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 value_ = smi->value(); 51 value_ = smi->value();
52 } 52 }
53 53
54 54
55 Smi* PropertyDetails::AsSmi() { 55 Smi* PropertyDetails::AsSmi() {
56 return Smi::FromInt(value_); 56 return Smi::FromInt(value_);
57 } 57 }
58 58
59 59
60 PropertyDetails PropertyDetails::AsDeleted() { 60 PropertyDetails PropertyDetails::AsDeleted() {
61 PropertyDetails d(DONT_ENUM, NORMAL); 61 Smi* smi = Smi::FromInt(value_ | DeletedField::encode(1));
62 Smi* smi = Smi::FromInt(AsSmi()->value() | DeletedField::encode(1));
63 return PropertyDetails(smi); 62 return PropertyDetails(smi);
64 } 63 }
65 64
66 65
67 #define CAST_ACCESSOR(type) \ 66 #define CAST_ACCESSOR(type) \
68 type* type::cast(Object* object) { \ 67 type* type::cast(Object* object) { \
69 ASSERT(object->Is##type()); \ 68 ASSERT(object->Is##type()); \
70 return reinterpret_cast<type*>(object); \ 69 return reinterpret_cast<type*>(object); \
71 } 70 }
72 71
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 411
413 412
414 bool MaybeObject::IsRetryAfterGC() { 413 bool MaybeObject::IsRetryAfterGC() {
415 return HAS_FAILURE_TAG(this) 414 return HAS_FAILURE_TAG(this)
416 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC; 415 && Failure::cast(this)->type() == Failure::RETRY_AFTER_GC;
417 } 416 }
418 417
419 418
420 bool MaybeObject::IsOutOfMemory() { 419 bool MaybeObject::IsOutOfMemory() {
421 return HAS_FAILURE_TAG(this) 420 return HAS_FAILURE_TAG(this)
422 && Failure::cast(this)->IsOutOfMemoryException(); 421 && Failure::cast(this)->IsOutOfMemoryException();
423 } 422 }
424 423
425 424
426 bool MaybeObject::IsException() { 425 bool MaybeObject::IsException() {
427 return this == Failure::Exception(); 426 return this == Failure::Exception();
428 } 427 }
429 428
430 429
431 bool MaybeObject::IsTheHole() { 430 bool MaybeObject::IsTheHole() {
432 return !IsFailure() && ToObjectUnchecked()->IsTheHole(); 431 return !IsFailure() && ToObjectUnchecked()->IsTheHole();
433 } 432 }
434 433
435 434
436 Failure* Failure::cast(MaybeObject* obj) { 435 Failure* Failure::cast(MaybeObject* obj) {
437 ASSERT(HAS_FAILURE_TAG(obj)); 436 ASSERT(HAS_FAILURE_TAG(obj));
438 return reinterpret_cast<Failure*>(obj); 437 return reinterpret_cast<Failure*>(obj);
439 } 438 }
440 439
441 440
442 bool Object::IsJSObject() { 441 bool Object::IsJSObject() {
443 return IsHeapObject() 442 return IsHeapObject()
444 && HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE; 443 && HeapObject::cast(this)->map()->instance_type() >= FIRST_JS_OBJECT_TYPE;
445 } 444 }
446 445
447 446
448 bool Object::IsJSContextExtensionObject() { 447 bool Object::IsJSContextExtensionObject() {
449 return IsHeapObject() 448 return IsHeapObject()
450 && (HeapObject::cast(this)->map()->instance_type() == 449 && (HeapObject::cast(this)->map()->instance_type() ==
451 JS_CONTEXT_EXTENSION_OBJECT_TYPE); 450 JS_CONTEXT_EXTENSION_OBJECT_TYPE);
452 } 451 }
453 452
454 453
455 bool Object::IsMap() { 454 bool Object::IsMap() {
456 return Object::IsHeapObject() 455 return Object::IsHeapObject()
457 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE; 456 && HeapObject::cast(this)->map()->instance_type() == MAP_TYPE;
458 } 457 }
459 458
460 459
461 bool Object::IsFixedArray() { 460 bool Object::IsFixedArray() {
462 return Object::IsHeapObject() 461 return Object::IsHeapObject()
463 && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE; 462 && HeapObject::cast(this)->map()->instance_type() == FIXED_ARRAY_TYPE;
464 } 463 }
465 464
466 465
467 bool Object::IsDescriptorArray() { 466 bool Object::IsDescriptorArray() {
468 return IsFixedArray(); 467 return IsFixedArray();
469 } 468 }
470 469
471 470
472 bool Object::IsDeoptimizationInputData() { 471 bool Object::IsDeoptimizationInputData() {
473 // Must be a fixed array. 472 // Must be a fixed array.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 515
517 bool Object::IsGlobalContext() { 516 bool Object::IsGlobalContext() {
518 return Object::IsHeapObject() && 517 return Object::IsHeapObject() &&
519 HeapObject::cast(this)->map() == 518 HeapObject::cast(this)->map() ==
520 HeapObject::cast(this)->GetHeap()->global_context_map(); 519 HeapObject::cast(this)->GetHeap()->global_context_map();
521 } 520 }
522 521
523 522
524 bool Object::IsJSFunction() { 523 bool Object::IsJSFunction() {
525 return Object::IsHeapObject() 524 return Object::IsHeapObject()
526 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE; 525 && HeapObject::cast(this)->map()->instance_type() == JS_FUNCTION_TYPE;
527 } 526 }
528 527
529 528
530 template <> inline bool Is<JSFunction>(Object* obj) { 529 template <> inline bool Is<JSFunction>(Object* obj) {
531 return obj->IsJSFunction(); 530 return obj->IsJSFunction();
532 } 531 }
533 532
534 533
535 bool Object::IsCode() { 534 bool Object::IsCode() {
536 return Object::IsHeapObject() 535 return Object::IsHeapObject()
537 && HeapObject::cast(this)->map()->instance_type() == CODE_TYPE; 536 && HeapObject::cast(this)->map()->instance_type() == CODE_TYPE;
538 } 537 }
539 538
540 539
541 bool Object::IsOddball() { 540 bool Object::IsOddball() {
542 ASSERT(HEAP->is_safe_to_read_maps()); 541 ASSERT(HEAP->is_safe_to_read_maps());
543 return Object::IsHeapObject() 542 return Object::IsHeapObject()
544 && HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE; 543 && HeapObject::cast(this)->map()->instance_type() == ODDBALL_TYPE;
545 } 544 }
546 545
547 546
548 bool Object::IsJSGlobalPropertyCell() { 547 bool Object::IsJSGlobalPropertyCell() {
549 return Object::IsHeapObject() 548 return Object::IsHeapObject()
550 && HeapObject::cast(this)->map()->instance_type() 549 && HeapObject::cast(this)->map()->instance_type()
551 == JS_GLOBAL_PROPERTY_CELL_TYPE; 550 == JS_GLOBAL_PROPERTY_CELL_TYPE;
552 } 551 }
553 552
554 553
555 bool Object::IsSharedFunctionInfo() { 554 bool Object::IsSharedFunctionInfo() {
556 return Object::IsHeapObject() && 555 return Object::IsHeapObject() &&
557 (HeapObject::cast(this)->map()->instance_type() == 556 (HeapObject::cast(this)->map()->instance_type() ==
558 SHARED_FUNCTION_INFO_TYPE); 557 SHARED_FUNCTION_INFO_TYPE);
559 } 558 }
560 559
561 560
562 bool Object::IsJSValue() { 561 bool Object::IsJSValue() {
563 return Object::IsHeapObject() 562 return Object::IsHeapObject()
564 && HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE; 563 && HeapObject::cast(this)->map()->instance_type() == JS_VALUE_TYPE;
564 }
565
566
567 bool Object::IsJSMessageObject() {
568 return Object::IsHeapObject()
569 && (HeapObject::cast(this)->map()->instance_type() ==
570 JS_MESSAGE_OBJECT_TYPE);
565 } 571 }
566 572
567 573
568 bool Object::IsStringWrapper() { 574 bool Object::IsStringWrapper() {
569 return IsJSValue() && JSValue::cast(this)->value()->IsString(); 575 return IsJSValue() && JSValue::cast(this)->value()->IsString();
570 } 576 }
571 577
572 578
573 bool Object::IsProxy() { 579 bool Object::IsProxy() {
574 return Object::IsHeapObject() 580 return Object::IsHeapObject()
575 && HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE; 581 && HeapObject::cast(this)->map()->instance_type() == PROXY_TYPE;
576 } 582 }
577 583
578 584
579 bool Object::IsBoolean() { 585 bool Object::IsBoolean() {
580 return IsOddball() && 586 return IsOddball() &&
581 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0); 587 ((Oddball::cast(this)->kind() & Oddball::kNotBooleanMask) == 0);
582 } 588 }
583 589
584 590
585 bool Object::IsJSArray() { 591 bool Object::IsJSArray() {
586 return Object::IsHeapObject() 592 return Object::IsHeapObject()
587 && HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE; 593 && HeapObject::cast(this)->map()->instance_type() == JS_ARRAY_TYPE;
588 } 594 }
589 595
590 596
591 bool Object::IsJSRegExp() { 597 bool Object::IsJSRegExp() {
592 return Object::IsHeapObject() 598 return Object::IsHeapObject()
593 && HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE; 599 && HeapObject::cast(this)->map()->instance_type() == JS_REGEXP_TYPE;
594 } 600 }
595 601
596 602
597 template <> inline bool Is<JSArray>(Object* obj) { 603 template <> inline bool Is<JSArray>(Object* obj) {
598 return obj->IsJSArray(); 604 return obj->IsJSArray();
599 } 605 }
600 606
601 607
602 bool Object::IsHashTable() { 608 bool Object::IsHashTable() {
603 return Object::IsHeapObject() && 609 return Object::IsHeapObject() &&
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 case JS_FUNCTION_TYPE: 1336 case JS_FUNCTION_TYPE:
1331 return JSFunction::kSize; 1337 return JSFunction::kSize;
1332 case JS_VALUE_TYPE: 1338 case JS_VALUE_TYPE:
1333 return JSValue::kSize; 1339 return JSValue::kSize;
1334 case JS_ARRAY_TYPE: 1340 case JS_ARRAY_TYPE:
1335 return JSValue::kSize; 1341 return JSValue::kSize;
1336 case JS_REGEXP_TYPE: 1342 case JS_REGEXP_TYPE:
1337 return JSValue::kSize; 1343 return JSValue::kSize;
1338 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1344 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1339 return JSObject::kHeaderSize; 1345 return JSObject::kHeaderSize;
1346 case JS_MESSAGE_OBJECT_TYPE:
1347 return JSMessageObject::kSize;
1340 default: 1348 default:
1341 UNREACHABLE(); 1349 UNREACHABLE();
1342 return 0; 1350 return 0;
1343 } 1351 }
1344 } 1352 }
1345 1353
1346 1354
1347 int JSObject::GetInternalFieldCount() { 1355 int JSObject::GetInternalFieldCount() {
1348 ASSERT(1 << kPointerSizeLog2 == kPointerSize); 1356 ASSERT(1 << kPointerSizeLog2 == kPointerSize);
1349 // Make sure to adjust for the number of in-object properties. These 1357 // Make sure to adjust for the number of in-object properties. These
(...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after
3381 ACCESSORS(JSValue, value, Object, kValueOffset) 3389 ACCESSORS(JSValue, value, Object, kValueOffset)
3382 3390
3383 3391
3384 JSValue* JSValue::cast(Object* obj) { 3392 JSValue* JSValue::cast(Object* obj) {
3385 ASSERT(obj->IsJSValue()); 3393 ASSERT(obj->IsJSValue());
3386 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); 3394 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize);
3387 return reinterpret_cast<JSValue*>(obj); 3395 return reinterpret_cast<JSValue*>(obj);
3388 } 3396 }
3389 3397
3390 3398
3399 ACCESSORS(JSMessageObject, type, String, kTypeOffset)
3400 ACCESSORS(JSMessageObject, arguments, JSArray, kArgumentsOffset)
3401 ACCESSORS(JSMessageObject, script, Object, kScriptOffset)
3402 ACCESSORS(JSMessageObject, stack_trace, Object, kStackTraceOffset)
3403 ACCESSORS(JSMessageObject, stack_frames, Object, kStackFramesOffset)
3404 SMI_ACCESSORS(JSMessageObject, start_position, kStartPositionOffset)
3405 SMI_ACCESSORS(JSMessageObject, end_position, kEndPositionOffset)
3406
3407
3408 JSMessageObject* JSMessageObject::cast(Object* obj) {
3409 ASSERT(obj->IsJSMessageObject());
3410 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize);
3411 return reinterpret_cast<JSMessageObject*>(obj);
3412 }
3413
3414
3391 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) 3415 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
3392 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) 3416 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
3393 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) 3417 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
3394 3418
3395 3419
3396 byte* Code::instruction_start() { 3420 byte* Code::instruction_start() {
3397 return FIELD_ADDR(this, kHeaderSize); 3421 return FIELD_ADDR(this, kHeaderSize);
3398 } 3422 }
3399 3423
3400 3424
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
4037 #undef WRITE_INT_FIELD 4061 #undef WRITE_INT_FIELD
4038 #undef READ_SHORT_FIELD 4062 #undef READ_SHORT_FIELD
4039 #undef WRITE_SHORT_FIELD 4063 #undef WRITE_SHORT_FIELD
4040 #undef READ_BYTE_FIELD 4064 #undef READ_BYTE_FIELD
4041 #undef WRITE_BYTE_FIELD 4065 #undef WRITE_BYTE_FIELD
4042 4066
4043 4067
4044 } } // namespace v8::internal 4068 } } // namespace v8::internal
4045 4069
4046 #endif // V8_OBJECTS_INL_H_ 4070 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/ast.cc ('K') | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698