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

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

Issue 9844002: Implement rudimentary module linking. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased Created 8 years, 8 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/objects-debug.cc ('k') | src/objects-printer.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 574
575 575
576 bool Object::IsContext() { 576 bool Object::IsContext() {
577 if (Object::IsHeapObject()) { 577 if (Object::IsHeapObject()) {
578 Map* map = HeapObject::cast(this)->map(); 578 Map* map = HeapObject::cast(this)->map();
579 Heap* heap = map->GetHeap(); 579 Heap* heap = map->GetHeap();
580 return (map == heap->function_context_map() || 580 return (map == heap->function_context_map() ||
581 map == heap->catch_context_map() || 581 map == heap->catch_context_map() ||
582 map == heap->with_context_map() || 582 map == heap->with_context_map() ||
583 map == heap->global_context_map() || 583 map == heap->global_context_map() ||
584 map == heap->block_context_map()); 584 map == heap->block_context_map() ||
585 map == heap->module_context_map());
585 } 586 }
586 return false; 587 return false;
587 } 588 }
588 589
589 590
590 bool Object::IsGlobalContext() { 591 bool Object::IsGlobalContext() {
591 return Object::IsHeapObject() && 592 return Object::IsHeapObject() &&
592 HeapObject::cast(this)->map() == 593 HeapObject::cast(this)->map() ==
593 HeapObject::cast(this)->GetHeap()->global_context_map(); 594 HeapObject::cast(this)->GetHeap()->global_context_map();
594 } 595 }
595 596
596 597
598 bool Object::IsModuleContext() {
599 return Object::IsHeapObject() &&
600 HeapObject::cast(this)->map() ==
601 HeapObject::cast(this)->GetHeap()->module_context_map();
602 }
603
604
597 bool Object::IsScopeInfo() { 605 bool Object::IsScopeInfo() {
598 return Object::IsHeapObject() && 606 return Object::IsHeapObject() &&
599 HeapObject::cast(this)->map() == 607 HeapObject::cast(this)->map() ==
600 HeapObject::cast(this)->GetHeap()->scope_info_map(); 608 HeapObject::cast(this)->GetHeap()->scope_info_map();
601 } 609 }
602 610
603 611
604 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) 612 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE)
605 613
606 614
607 template <> inline bool Is<JSFunction>(Object* obj) { 615 template <> inline bool Is<JSFunction>(Object* obj) {
608 return obj->IsJSFunction(); 616 return obj->IsJSFunction();
609 } 617 }
610 618
611 619
612 TYPE_CHECKER(Code, CODE_TYPE) 620 TYPE_CHECKER(Code, CODE_TYPE)
613 TYPE_CHECKER(Oddball, ODDBALL_TYPE) 621 TYPE_CHECKER(Oddball, ODDBALL_TYPE)
614 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) 622 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE)
615 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) 623 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE)
624 TYPE_CHECKER(JSModule, JS_MODULE_TYPE)
616 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) 625 TYPE_CHECKER(JSValue, JS_VALUE_TYPE)
617 TYPE_CHECKER(JSDate, JS_DATE_TYPE) 626 TYPE_CHECKER(JSDate, JS_DATE_TYPE)
618 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) 627 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE)
619 628
620 629
621 bool Object::IsStringWrapper() { 630 bool Object::IsStringWrapper() {
622 return IsJSValue() && JSValue::cast(this)->value()->IsString(); 631 return IsJSValue() && JSValue::cast(this)->value()->IsString();
623 } 632 }
624 633
625 634
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
1429 } 1438 }
1430 1439
1431 1440
1432 int JSObject::GetHeaderSize() { 1441 int JSObject::GetHeaderSize() {
1433 InstanceType type = map()->instance_type(); 1442 InstanceType type = map()->instance_type();
1434 // Check for the most common kind of JavaScript object before 1443 // Check for the most common kind of JavaScript object before
1435 // falling into the generic switch. This speeds up the internal 1444 // falling into the generic switch. This speeds up the internal
1436 // field operations considerably on average. 1445 // field operations considerably on average.
1437 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; 1446 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize;
1438 switch (type) { 1447 switch (type) {
1448 case JS_MODULE_TYPE:
1449 return JSModule::kSize;
1439 case JS_GLOBAL_PROXY_TYPE: 1450 case JS_GLOBAL_PROXY_TYPE:
1440 return JSGlobalProxy::kSize; 1451 return JSGlobalProxy::kSize;
1441 case JS_GLOBAL_OBJECT_TYPE: 1452 case JS_GLOBAL_OBJECT_TYPE:
1442 return JSGlobalObject::kSize; 1453 return JSGlobalObject::kSize;
1443 case JS_BUILTINS_OBJECT_TYPE: 1454 case JS_BUILTINS_OBJECT_TYPE:
1444 return JSBuiltinsObject::kSize; 1455 return JSBuiltinsObject::kSize;
1445 case JS_FUNCTION_TYPE: 1456 case JS_FUNCTION_TYPE:
1446 return JSFunction::kSize; 1457 return JSFunction::kSize;
1447 case JS_VALUE_TYPE: 1458 case JS_VALUE_TYPE:
1448 return JSValue::kSize; 1459 return JSValue::kSize;
(...skipping 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after
4071 Address Foreign::foreign_address() { 4082 Address Foreign::foreign_address() {
4072 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); 4083 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset));
4073 } 4084 }
4074 4085
4075 4086
4076 void Foreign::set_foreign_address(Address value) { 4087 void Foreign::set_foreign_address(Address value) {
4077 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); 4088 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value));
4078 } 4089 }
4079 4090
4080 4091
4092 ACCESSORS(JSModule, context, Object, kContextOffset)
4093
4094
4095 JSModule* JSModule::cast(Object* obj) {
4096 ASSERT(obj->IsJSModule());
4097 ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize);
4098 return reinterpret_cast<JSModule*>(obj);
4099 }
4100
4101
4081 ACCESSORS(JSValue, value, Object, kValueOffset) 4102 ACCESSORS(JSValue, value, Object, kValueOffset)
4082 4103
4083 4104
4084 JSValue* JSValue::cast(Object* obj) { 4105 JSValue* JSValue::cast(Object* obj) {
4085 ASSERT(obj->IsJSValue()); 4106 ASSERT(obj->IsJSValue());
4086 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize); 4107 ASSERT(HeapObject::cast(obj)->Size() == JSValue::kSize);
4087 return reinterpret_cast<JSValue*>(obj); 4108 return reinterpret_cast<JSValue*>(obj);
4088 } 4109 }
4089 4110
4090 4111
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
4926 #undef WRITE_UINT32_FIELD 4947 #undef WRITE_UINT32_FIELD
4927 #undef READ_SHORT_FIELD 4948 #undef READ_SHORT_FIELD
4928 #undef WRITE_SHORT_FIELD 4949 #undef WRITE_SHORT_FIELD
4929 #undef READ_BYTE_FIELD 4950 #undef READ_BYTE_FIELD
4930 #undef WRITE_BYTE_FIELD 4951 #undef WRITE_BYTE_FIELD
4931 4952
4932 4953
4933 } } // namespace v8::internal 4954 } } // namespace v8::internal
4934 4955
4935 #endif // V8_OBJECTS_INL_H_ 4956 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698