| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 // | 43 // |
| 44 // Most object types in the V8 JavaScript are described in this file. | 44 // Most object types in the V8 JavaScript are described in this file. |
| 45 // | 45 // |
| 46 // Inheritance hierarchy: | 46 // Inheritance hierarchy: |
| 47 // - MaybeObject (an object or a failure) | 47 // - MaybeObject (an object or a failure) |
| 48 // - Failure (immediate for marking failed operation) | 48 // - Failure (immediate for marking failed operation) |
| 49 // - Object | 49 // - Object |
| 50 // - Smi (immediate small integer) | 50 // - Smi (immediate small integer) |
| 51 // - HeapObject (superclass for everything allocated in the heap) | 51 // - HeapObject (superclass for everything allocated in the heap) |
| 52 // - JSObject | 52 // - JSReceiver (suitable for property access) |
| 53 // - JSArray | 53 // - JSObject |
| 54 // - JSRegExp | 54 // - JSArray |
| 55 // - JSFunction | 55 // - JSRegExp |
| 56 // - GlobalObject | 56 // - JSFunction |
| 57 // - JSGlobalObject | 57 // - GlobalObject |
| 58 // - JSBuiltinsObject | 58 // - JSGlobalObject |
| 59 // - JSGlobalProxy | 59 // - JSBuiltinsObject |
| 60 // - JSValue | 60 // - JSGlobalProxy |
| 61 // - JSMessageObject | 61 // - JSValue |
| 62 // - JSMessageObject |
| 63 // - JSProxy |
| 64 // - JSFunctionProxy |
| 62 // - ByteArray | 65 // - ByteArray |
| 63 // - FreeSpace | 66 // - FreeSpace |
| 64 // - ExternalArray | 67 // - ExternalArray |
| 65 // - ExternalPixelArray | 68 // - ExternalPixelArray |
| 66 // - ExternalByteArray | 69 // - ExternalByteArray |
| 67 // - ExternalUnsignedByteArray | 70 // - ExternalUnsignedByteArray |
| 68 // - ExternalShortArray | 71 // - ExternalShortArray |
| 69 // - ExternalUnsignedShortArray | 72 // - ExternalUnsignedShortArray |
| 70 // - ExternalIntArray | 73 // - ExternalIntArray |
| 71 // - ExternalUnsignedIntArray | 74 // - ExternalUnsignedIntArray |
| (...skipping 14 matching lines...) Expand all Loading... |
| 86 // - SeqAsciiString | 89 // - SeqAsciiString |
| 87 // - SeqTwoByteString | 90 // - SeqTwoByteString |
| 88 // - ConsString | 91 // - ConsString |
| 89 // - ExternalString | 92 // - ExternalString |
| 90 // - ExternalAsciiString | 93 // - ExternalAsciiString |
| 91 // - ExternalTwoByteString | 94 // - ExternalTwoByteString |
| 92 // - HeapNumber | 95 // - HeapNumber |
| 93 // - Code | 96 // - Code |
| 94 // - Map | 97 // - Map |
| 95 // - Oddball | 98 // - Oddball |
| 96 // - JSProxy | |
| 97 // - Foreign | 99 // - Foreign |
| 98 // - SharedFunctionInfo | 100 // - SharedFunctionInfo |
| 99 // - Struct | 101 // - Struct |
| 100 // - AccessorInfo | 102 // - AccessorInfo |
| 101 // - AccessCheckInfo | 103 // - AccessCheckInfo |
| 102 // - InterceptorInfo | 104 // - InterceptorInfo |
| 103 // - CallHandlerInfo | 105 // - CallHandlerInfo |
| 104 // - TemplateInfo | 106 // - TemplateInfo |
| 105 // - FunctionTemplateInfo | 107 // - FunctionTemplateInfo |
| 106 // - ObjectTemplateInfo | 108 // - ObjectTemplateInfo |
| (...skipping 22 matching lines...) Expand all Loading... |
| 129 }; | 131 }; |
| 130 | 132 |
| 131 namespace v8 { | 133 namespace v8 { |
| 132 namespace internal { | 134 namespace internal { |
| 133 | 135 |
| 134 | 136 |
| 135 // PropertyDetails captures type and attributes for a property. | 137 // PropertyDetails captures type and attributes for a property. |
| 136 // They are used both in property dictionaries and instance descriptors. | 138 // They are used both in property dictionaries and instance descriptors. |
| 137 class PropertyDetails BASE_EMBEDDED { | 139 class PropertyDetails BASE_EMBEDDED { |
| 138 public: | 140 public: |
| 139 | |
| 140 PropertyDetails(PropertyAttributes attributes, | 141 PropertyDetails(PropertyAttributes attributes, |
| 141 PropertyType type, | 142 PropertyType type, |
| 142 int index = 0) { | 143 int index = 0) { |
| 143 ASSERT(type != EXTERNAL_ARRAY_TRANSITION); | 144 ASSERT(type != EXTERNAL_ARRAY_TRANSITION); |
| 144 ASSERT(TypeField::is_valid(type)); | 145 ASSERT(TypeField::is_valid(type)); |
| 145 ASSERT(AttributesField::is_valid(attributes)); | 146 ASSERT(AttributesField::is_valid(attributes)); |
| 146 ASSERT(StorageField::is_valid(index)); | 147 ASSERT(StorageField::is_valid(index)); |
| 147 | 148 |
| 148 value_ = TypeField::encode(type) | 149 value_ = TypeField::encode(type) |
| 149 | AttributesField::encode(attributes) | 150 | AttributesField::encode(attributes) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool IsDeleted() { return DeletedField::decode(value_) != 0;} | 210 bool IsDeleted() { return DeletedField::decode(value_) != 0;} |
| 210 | 211 |
| 211 // Bit fields in value_ (type, shift, size). Must be public so the | 212 // Bit fields in value_ (type, shift, size). Must be public so the |
| 212 // constants can be embedded in generated code. | 213 // constants can be embedded in generated code. |
| 213 class TypeField: public BitField<PropertyType, 0, 4> {}; | 214 class TypeField: public BitField<PropertyType, 0, 4> {}; |
| 214 class AttributesField: public BitField<PropertyAttributes, 4, 3> {}; | 215 class AttributesField: public BitField<PropertyAttributes, 4, 3> {}; |
| 215 class DeletedField: public BitField<uint32_t, 7, 1> {}; | 216 class DeletedField: public BitField<uint32_t, 7, 1> {}; |
| 216 class StorageField: public BitField<uint32_t, 8, 32-8> {}; | 217 class StorageField: public BitField<uint32_t, 8, 32-8> {}; |
| 217 | 218 |
| 218 static const int kInitialIndex = 1; | 219 static const int kInitialIndex = 1; |
| 220 |
| 219 private: | 221 private: |
| 220 uint32_t value_; | 222 uint32_t value_; |
| 221 }; | 223 }; |
| 222 | 224 |
| 223 | 225 |
| 224 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. | 226 // Setter that skips the write barrier if mode is SKIP_WRITE_BARRIER. |
| 225 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; | 227 enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER }; |
| 226 | 228 |
| 227 | 229 |
| 228 // PropertyNormalizationMode is used to specify whether to keep | 230 // PropertyNormalizationMode is used to specify whether to keep |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ | 286 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ |
| 285 V(EXTERNAL_ASCII_STRING_TYPE) \ | 287 V(EXTERNAL_ASCII_STRING_TYPE) \ |
| 286 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ | 288 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ |
| 287 \ | 289 \ |
| 288 V(MAP_TYPE) \ | 290 V(MAP_TYPE) \ |
| 289 V(CODE_TYPE) \ | 291 V(CODE_TYPE) \ |
| 290 V(ODDBALL_TYPE) \ | 292 V(ODDBALL_TYPE) \ |
| 291 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ | 293 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
| 292 \ | 294 \ |
| 293 V(HEAP_NUMBER_TYPE) \ | 295 V(HEAP_NUMBER_TYPE) \ |
| 294 V(JS_PROXY_TYPE) \ | |
| 295 V(FOREIGN_TYPE) \ | 296 V(FOREIGN_TYPE) \ |
| 296 V(BYTE_ARRAY_TYPE) \ | 297 V(BYTE_ARRAY_TYPE) \ |
| 297 V(FREE_SPACE_TYPE) \ | 298 V(FREE_SPACE_TYPE) \ |
| 298 /* Note: the order of these external array */ \ | 299 /* Note: the order of these external array */ \ |
| 299 /* types is relied upon in */ \ | 300 /* types is relied upon in */ \ |
| 300 /* Object::IsExternalArray(). */ \ | 301 /* Object::IsExternalArray(). */ \ |
| 301 V(EXTERNAL_BYTE_ARRAY_TYPE) \ | 302 V(EXTERNAL_BYTE_ARRAY_TYPE) \ |
| 302 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ | 303 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ |
| 303 V(EXTERNAL_SHORT_ARRAY_TYPE) \ | 304 V(EXTERNAL_SHORT_ARRAY_TYPE) \ |
| 304 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ | 305 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ |
| 305 V(EXTERNAL_INT_ARRAY_TYPE) \ | 306 V(EXTERNAL_INT_ARRAY_TYPE) \ |
| 306 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ | 307 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ |
| 307 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ | 308 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ |
| 308 V(EXTERNAL_PIXEL_ARRAY_TYPE) \ | 309 V(EXTERNAL_PIXEL_ARRAY_TYPE) \ |
| 309 V(FILLER_TYPE) \ | 310 V(FILLER_TYPE) \ |
| 310 \ | 311 \ |
| 311 V(ACCESSOR_INFO_TYPE) \ | 312 V(ACCESSOR_INFO_TYPE) \ |
| 312 V(ACCESS_CHECK_INFO_TYPE) \ | 313 V(ACCESS_CHECK_INFO_TYPE) \ |
| 313 V(INTERCEPTOR_INFO_TYPE) \ | 314 V(INTERCEPTOR_INFO_TYPE) \ |
| 314 V(CALL_HANDLER_INFO_TYPE) \ | 315 V(CALL_HANDLER_INFO_TYPE) \ |
| 315 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 316 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
| 316 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 317 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
| 317 V(SIGNATURE_INFO_TYPE) \ | 318 V(SIGNATURE_INFO_TYPE) \ |
| 318 V(TYPE_SWITCH_INFO_TYPE) \ | 319 V(TYPE_SWITCH_INFO_TYPE) \ |
| 319 V(SCRIPT_TYPE) \ | 320 V(SCRIPT_TYPE) \ |
| 320 V(CODE_CACHE_TYPE) \ | 321 V(CODE_CACHE_TYPE) \ |
| 322 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
| 321 \ | 323 \ |
| 322 V(FIXED_ARRAY_TYPE) \ | 324 V(FIXED_ARRAY_TYPE) \ |
| 323 V(SHARED_FUNCTION_INFO_TYPE) \ | 325 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 324 \ | 326 \ |
| 325 V(JS_MESSAGE_OBJECT_TYPE) \ | 327 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 326 \ | 328 \ |
| 327 V(JS_VALUE_TYPE) \ | 329 V(JS_VALUE_TYPE) \ |
| 328 V(JS_OBJECT_TYPE) \ | 330 V(JS_OBJECT_TYPE) \ |
| 329 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 331 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 330 V(JS_GLOBAL_OBJECT_TYPE) \ | 332 V(JS_GLOBAL_OBJECT_TYPE) \ |
| 331 V(JS_BUILTINS_OBJECT_TYPE) \ | 333 V(JS_BUILTINS_OBJECT_TYPE) \ |
| 332 V(JS_GLOBAL_PROXY_TYPE) \ | 334 V(JS_GLOBAL_PROXY_TYPE) \ |
| 333 V(JS_ARRAY_TYPE) \ | 335 V(JS_ARRAY_TYPE) \ |
| 336 V(JS_PROXY_TYPE) \ |
| 334 V(JS_REGEXP_TYPE) \ | 337 V(JS_REGEXP_TYPE) \ |
| 335 \ | 338 \ |
| 336 V(JS_FUNCTION_TYPE) \ | 339 V(JS_FUNCTION_TYPE) \ |
| 340 V(JS_FUNCTION_PROXY_TYPE) \ |
| 337 | 341 |
| 338 #ifdef ENABLE_DEBUGGER_SUPPORT | 342 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 339 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ | 343 #define INSTANCE_TYPE_LIST_DEBUGGER(V) \ |
| 340 V(DEBUG_INFO_TYPE) \ | 344 V(DEBUG_INFO_TYPE) \ |
| 341 V(BREAK_POINT_INFO_TYPE) | 345 V(BREAK_POINT_INFO_TYPE) |
| 342 #else | 346 #else |
| 343 #define INSTANCE_TYPE_LIST_DEBUGGER(V) | 347 #define INSTANCE_TYPE_LIST_DEBUGGER(V) |
| 344 #endif | 348 #endif |
| 345 | 349 |
| 346 #define INSTANCE_TYPE_LIST(V) \ | 350 #define INSTANCE_TYPE_LIST(V) \ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 #define STRUCT_LIST_ALL(V) \ | 424 #define STRUCT_LIST_ALL(V) \ |
| 421 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ | 425 V(ACCESSOR_INFO, AccessorInfo, accessor_info) \ |
| 422 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ | 426 V(ACCESS_CHECK_INFO, AccessCheckInfo, access_check_info) \ |
| 423 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ | 427 V(INTERCEPTOR_INFO, InterceptorInfo, interceptor_info) \ |
| 424 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ | 428 V(CALL_HANDLER_INFO, CallHandlerInfo, call_handler_info) \ |
| 425 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ | 429 V(FUNCTION_TEMPLATE_INFO, FunctionTemplateInfo, function_template_info) \ |
| 426 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ | 430 V(OBJECT_TEMPLATE_INFO, ObjectTemplateInfo, object_template_info) \ |
| 427 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ | 431 V(SIGNATURE_INFO, SignatureInfo, signature_info) \ |
| 428 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ | 432 V(TYPE_SWITCH_INFO, TypeSwitchInfo, type_switch_info) \ |
| 429 V(SCRIPT, Script, script) \ | 433 V(SCRIPT, Script, script) \ |
| 430 V(CODE_CACHE, CodeCache, code_cache) | 434 V(CODE_CACHE, CodeCache, code_cache) \ |
| 435 V(POLYMORPHIC_CODE_CACHE, PolymorphicCodeCache, polymorphic_code_cache) |
| 431 | 436 |
| 432 #ifdef ENABLE_DEBUGGER_SUPPORT | 437 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 433 #define STRUCT_LIST_DEBUGGER(V) \ | 438 #define STRUCT_LIST_DEBUGGER(V) \ |
| 434 V(DEBUG_INFO, DebugInfo, debug_info) \ | 439 V(DEBUG_INFO, DebugInfo, debug_info) \ |
| 435 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) | 440 V(BREAK_POINT_INFO, BreakPointInfo, break_point_info) |
| 436 #else | 441 #else |
| 437 #define STRUCT_LIST_DEBUGGER(V) | 442 #define STRUCT_LIST_DEBUGGER(V) |
| 438 #endif | 443 #endif |
| 439 | 444 |
| 440 #define STRUCT_LIST(V) \ | 445 #define STRUCT_LIST(V) \ |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 514 // Objects allocated in their own spaces (never in new space). | 519 // Objects allocated in their own spaces (never in new space). |
| 515 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 520 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 516 CODE_TYPE, | 521 CODE_TYPE, |
| 517 ODDBALL_TYPE, | 522 ODDBALL_TYPE, |
| 518 JS_GLOBAL_PROPERTY_CELL_TYPE, | 523 JS_GLOBAL_PROPERTY_CELL_TYPE, |
| 519 | 524 |
| 520 // "Data", objects that cannot contain non-map-word pointers to heap | 525 // "Data", objects that cannot contain non-map-word pointers to heap |
| 521 // objects. | 526 // objects. |
| 522 HEAP_NUMBER_TYPE, | 527 HEAP_NUMBER_TYPE, |
| 523 FOREIGN_TYPE, | 528 FOREIGN_TYPE, |
| 524 JS_PROXY_TYPE, | |
| 525 BYTE_ARRAY_TYPE, | 529 BYTE_ARRAY_TYPE, |
| 526 FREE_SPACE_TYPE, | 530 FREE_SPACE_TYPE, |
| 527 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 531 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 528 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, | 532 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, |
| 529 EXTERNAL_SHORT_ARRAY_TYPE, | 533 EXTERNAL_SHORT_ARRAY_TYPE, |
| 530 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, | 534 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, |
| 531 EXTERNAL_INT_ARRAY_TYPE, | 535 EXTERNAL_INT_ARRAY_TYPE, |
| 532 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, | 536 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, |
| 533 EXTERNAL_FLOAT_ARRAY_TYPE, | 537 EXTERNAL_FLOAT_ARRAY_TYPE, |
| 534 EXTERNAL_DOUBLE_ARRAY_TYPE, | 538 EXTERNAL_DOUBLE_ARRAY_TYPE, |
| 535 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 539 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
| 540 FIXED_DOUBLE_ARRAY_TYPE, |
| 536 FILLER_TYPE, // LAST_DATA_TYPE | 541 FILLER_TYPE, // LAST_DATA_TYPE |
| 537 | 542 |
| 538 // Structs. | 543 // Structs. |
| 539 ACCESSOR_INFO_TYPE, | 544 ACCESSOR_INFO_TYPE, |
| 540 ACCESS_CHECK_INFO_TYPE, | 545 ACCESS_CHECK_INFO_TYPE, |
| 541 INTERCEPTOR_INFO_TYPE, | 546 INTERCEPTOR_INFO_TYPE, |
| 542 CALL_HANDLER_INFO_TYPE, | 547 CALL_HANDLER_INFO_TYPE, |
| 543 FUNCTION_TEMPLATE_INFO_TYPE, | 548 FUNCTION_TEMPLATE_INFO_TYPE, |
| 544 OBJECT_TEMPLATE_INFO_TYPE, | 549 OBJECT_TEMPLATE_INFO_TYPE, |
| 545 SIGNATURE_INFO_TYPE, | 550 SIGNATURE_INFO_TYPE, |
| 546 TYPE_SWITCH_INFO_TYPE, | 551 TYPE_SWITCH_INFO_TYPE, |
| 547 SCRIPT_TYPE, | 552 SCRIPT_TYPE, |
| 548 CODE_CACHE_TYPE, | 553 CODE_CACHE_TYPE, |
| 554 POLYMORPHIC_CODE_CACHE_TYPE, |
| 549 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT | 555 // The following two instance types are only used when ENABLE_DEBUGGER_SUPPORT |
| 550 // is defined. However as include/v8.h contain some of the instance type | 556 // is defined. However as include/v8.h contain some of the instance type |
| 551 // constants always having them avoids them getting different numbers | 557 // constants always having them avoids them getting different numbers |
| 552 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. | 558 // depending on whether ENABLE_DEBUGGER_SUPPORT is defined or not. |
| 553 DEBUG_INFO_TYPE, | 559 DEBUG_INFO_TYPE, |
| 554 BREAK_POINT_INFO_TYPE, | 560 BREAK_POINT_INFO_TYPE, |
| 555 | 561 |
| 556 FIXED_ARRAY_TYPE, | 562 FIXED_ARRAY_TYPE, |
| 557 SHARED_FUNCTION_INFO_TYPE, | 563 SHARED_FUNCTION_INFO_TYPE, |
| 558 | 564 |
| 559 JS_MESSAGE_OBJECT_TYPE, | 565 JS_MESSAGE_OBJECT_TYPE, |
| 560 | 566 |
| 561 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | 567 JS_VALUE_TYPE, // FIRST_NON_CALLABLE_OBJECT_TYPE, FIRST_JS_RECEIVER_TYPE |
| 562 JS_OBJECT_TYPE, | 568 JS_OBJECT_TYPE, |
| 563 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 569 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 564 JS_GLOBAL_OBJECT_TYPE, | 570 JS_GLOBAL_OBJECT_TYPE, |
| 565 JS_BUILTINS_OBJECT_TYPE, | 571 JS_BUILTINS_OBJECT_TYPE, |
| 566 JS_GLOBAL_PROXY_TYPE, | 572 JS_GLOBAL_PROXY_TYPE, |
| 567 JS_ARRAY_TYPE, | 573 JS_ARRAY_TYPE, |
| 574 JS_PROXY_TYPE, |
| 568 | 575 |
| 569 JS_REGEXP_TYPE, // LAST_JS_OBJECT_TYPE, FIRST_FUNCTION_CLASS_TYPE | 576 JS_REGEXP_TYPE, // LAST_NONCALLABLE_SPEC_OBJECT_TYPE |
| 570 | 577 |
| 571 JS_FUNCTION_TYPE, | 578 JS_FUNCTION_TYPE, // FIRST_CALLABLE_SPEC_OBJECT_TYPE |
| 579 JS_FUNCTION_PROXY_TYPE, // LAST_CALLABLE_SPEC_OBJECT_TYPE |
| 572 | 580 |
| 573 // Pseudo-types | 581 // Pseudo-types |
| 574 FIRST_TYPE = 0x0, | 582 FIRST_TYPE = 0x0, |
| 575 LAST_TYPE = JS_FUNCTION_TYPE, | 583 LAST_TYPE = JS_FUNCTION_PROXY_TYPE, |
| 576 INVALID_TYPE = FIRST_TYPE - 1, | 584 INVALID_TYPE = FIRST_TYPE - 1, |
| 577 FIRST_NONSTRING_TYPE = MAP_TYPE, | 585 FIRST_NONSTRING_TYPE = MAP_TYPE, |
| 578 // Boundaries for testing for an external array. | 586 // Boundaries for testing for an external array. |
| 579 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, | 587 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, |
| 580 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, | 588 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE, |
| 581 // Boundary for promotion to old data space/old pointer space. | 589 // Boundary for promotion to old data space/old pointer space. |
| 582 LAST_DATA_TYPE = FILLER_TYPE, | 590 LAST_DATA_TYPE = FILLER_TYPE, |
| 583 // Boundaries for testing the type is a JavaScript "object". Note that | 591 // Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy). |
| 584 // function objects are not counted as objects, even though they are | 592 // Note that there is no range for JSObject or JSProxy, since their subtypes |
| 585 // implemented as such; only values whose typeof is "object" are included. | 593 // are not continuous in this enum! The enum ranges instead reflect the |
| 586 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, | 594 // external class names, where proxies are treated as either ordinary objects, |
| 587 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE, | 595 // or functions. |
| 588 // RegExp objects have [[Class]] "function" because they are callable. | 596 FIRST_JS_RECEIVER_TYPE = JS_VALUE_TYPE, |
| 589 // All types from this type and above are objects with [[Class]] "function". | 597 LAST_JS_RECEIVER_TYPE = LAST_TYPE, |
| 590 FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE | 598 // Boundaries for testing the types for which typeof is "object". |
| 599 FIRST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_VALUE_TYPE, |
| 600 LAST_NONCALLABLE_SPEC_OBJECT_TYPE = JS_REGEXP_TYPE, |
| 601 // Boundaries for testing the types for which typeof is "function". |
| 602 FIRST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_TYPE, |
| 603 LAST_CALLABLE_SPEC_OBJECT_TYPE = JS_FUNCTION_PROXY_TYPE, |
| 604 // Boundaries for testing whether the type is a JavaScript object. |
| 605 FIRST_SPEC_OBJECT_TYPE = FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, |
| 606 LAST_SPEC_OBJECT_TYPE = LAST_CALLABLE_SPEC_OBJECT_TYPE |
| 591 }; | 607 }; |
| 592 | 608 |
| 593 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE - | 609 static const int kExternalArrayTypeCount = LAST_EXTERNAL_ARRAY_TYPE - |
| 594 FIRST_EXTERNAL_ARRAY_TYPE + 1; | 610 FIRST_EXTERNAL_ARRAY_TYPE + 1; |
| 595 | 611 |
| 596 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); | 612 STATIC_CHECK(JS_OBJECT_TYPE == Internals::kJSObjectType); |
| 597 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); | 613 STATIC_CHECK(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType); |
| 598 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); | 614 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); |
| 599 | 615 |
| 600 | 616 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 V(ExternalUnsignedByteArray) \ | 723 V(ExternalUnsignedByteArray) \ |
| 708 V(ExternalShortArray) \ | 724 V(ExternalShortArray) \ |
| 709 V(ExternalUnsignedShortArray) \ | 725 V(ExternalUnsignedShortArray) \ |
| 710 V(ExternalIntArray) \ | 726 V(ExternalIntArray) \ |
| 711 V(ExternalUnsignedIntArray) \ | 727 V(ExternalUnsignedIntArray) \ |
| 712 V(ExternalFloatArray) \ | 728 V(ExternalFloatArray) \ |
| 713 V(ExternalDoubleArray) \ | 729 V(ExternalDoubleArray) \ |
| 714 V(ExternalPixelArray) \ | 730 V(ExternalPixelArray) \ |
| 715 V(ByteArray) \ | 731 V(ByteArray) \ |
| 716 V(FreeSpace) \ | 732 V(FreeSpace) \ |
| 733 V(JSReceiver) \ |
| 717 V(JSObject) \ | 734 V(JSObject) \ |
| 718 V(JSContextExtensionObject) \ | 735 V(JSContextExtensionObject) \ |
| 719 V(Map) \ | 736 V(Map) \ |
| 720 V(DescriptorArray) \ | 737 V(DescriptorArray) \ |
| 721 V(DeoptimizationInputData) \ | 738 V(DeoptimizationInputData) \ |
| 722 V(DeoptimizationOutputData) \ | 739 V(DeoptimizationOutputData) \ |
| 723 V(FixedArray) \ | 740 V(FixedArray) \ |
| 741 V(FixedDoubleArray) \ |
| 724 V(Context) \ | 742 V(Context) \ |
| 725 V(CatchContext) \ | |
| 726 V(GlobalContext) \ | 743 V(GlobalContext) \ |
| 727 V(JSFunction) \ | 744 V(JSFunction) \ |
| 728 V(Code) \ | 745 V(Code) \ |
| 729 V(Oddball) \ | 746 V(Oddball) \ |
| 730 V(SharedFunctionInfo) \ | 747 V(SharedFunctionInfo) \ |
| 731 V(JSValue) \ | 748 V(JSValue) \ |
| 732 V(JSMessageObject) \ | 749 V(JSMessageObject) \ |
| 733 V(StringWrapper) \ | 750 V(StringWrapper) \ |
| 734 V(Foreign) \ | 751 V(Foreign) \ |
| 735 V(Boolean) \ | 752 V(Boolean) \ |
| 736 V(JSArray) \ | 753 V(JSArray) \ |
| 737 V(JSProxy) \ | 754 V(JSProxy) \ |
| 755 V(JSFunctionProxy) \ |
| 738 V(JSRegExp) \ | 756 V(JSRegExp) \ |
| 739 V(HashTable) \ | 757 V(HashTable) \ |
| 740 V(Dictionary) \ | 758 V(Dictionary) \ |
| 741 V(SymbolTable) \ | 759 V(SymbolTable) \ |
| 742 V(JSFunctionResultCache) \ | 760 V(JSFunctionResultCache) \ |
| 743 V(NormalizedMapCache) \ | 761 V(NormalizedMapCache) \ |
| 744 V(CompilationCacheTable) \ | 762 V(CompilationCacheTable) \ |
| 745 V(CodeCacheHashTable) \ | 763 V(CodeCacheHashTable) \ |
| 764 V(PolymorphicCodeCacheHashTable) \ |
| 746 V(MapCache) \ | 765 V(MapCache) \ |
| 747 V(Primitive) \ | 766 V(Primitive) \ |
| 748 V(GlobalObject) \ | 767 V(GlobalObject) \ |
| 749 V(JSGlobalObject) \ | 768 V(JSGlobalObject) \ |
| 750 V(JSBuiltinsObject) \ | 769 V(JSBuiltinsObject) \ |
| 751 V(JSGlobalProxy) \ | 770 V(JSGlobalProxy) \ |
| 752 V(UndetectableObject) \ | 771 V(UndetectableObject) \ |
| 753 V(AccessCheckNeeded) \ | 772 V(AccessCheckNeeded) \ |
| 754 V(JSGlobalPropertyCell) \ | 773 V(JSGlobalPropertyCell) \ |
| 755 | 774 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 784 INLINE(bool IsFalse()); | 803 INLINE(bool IsFalse()); |
| 785 inline bool IsArgumentsMarker(); | 804 inline bool IsArgumentsMarker(); |
| 786 inline bool NonFailureIsHeapObject(); | 805 inline bool NonFailureIsHeapObject(); |
| 787 | 806 |
| 788 // Filler objects (fillers and free space objects). | 807 // Filler objects (fillers and free space objects). |
| 789 inline bool IsFiller(); | 808 inline bool IsFiller(); |
| 790 | 809 |
| 791 // Extract the number. | 810 // Extract the number. |
| 792 inline double Number(); | 811 inline double Number(); |
| 793 | 812 |
| 813 // Returns true if the object is of the correct type to be used as a |
| 814 // implementation of a JSObject's elements. |
| 815 inline bool HasValidElements(); |
| 816 |
| 794 inline bool HasSpecificClassOf(String* name); | 817 inline bool HasSpecificClassOf(String* name); |
| 795 | 818 |
| 796 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. | 819 MUST_USE_RESULT MaybeObject* ToObject(); // ECMA-262 9.9. |
| 797 Object* ToBoolean(); // ECMA-262 9.2. | 820 Object* ToBoolean(); // ECMA-262 9.2. |
| 798 | 821 |
| 799 // Convert to a JSObject if needed. | 822 // Convert to a JSObject if needed. |
| 800 // global_context is used when creating wrapper object. | 823 // global_context is used when creating wrapper object. |
| 801 MUST_USE_RESULT MaybeObject* ToObject(Context* global_context); | 824 MUST_USE_RESULT MaybeObject* ToObject(Context* global_context); |
| 802 | 825 |
| 803 // Converts this to a Smi if possible. | 826 // Converts this to a Smi if possible. |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1221 static const int kExponentBias = 1023; | 1244 static const int kExponentBias = 1023; |
| 1222 static const int kExponentShift = 20; | 1245 static const int kExponentShift = 20; |
| 1223 static const int kMantissaBitsInTopWord = 20; | 1246 static const int kMantissaBitsInTopWord = 20; |
| 1224 static const int kNonMantissaBitsInTopWord = 12; | 1247 static const int kNonMantissaBitsInTopWord = 12; |
| 1225 | 1248 |
| 1226 private: | 1249 private: |
| 1227 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); | 1250 DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber); |
| 1228 }; | 1251 }; |
| 1229 | 1252 |
| 1230 | 1253 |
| 1254 // JSReceiver includes types on which properties can be defined, i.e., |
| 1255 // JSObject and JSProxy. |
| 1256 class JSReceiver: public HeapObject { |
| 1257 public: |
| 1258 // Casting. |
| 1259 static inline JSReceiver* cast(Object* obj); |
| 1260 |
| 1261 // Can cause GC. |
| 1262 MUST_USE_RESULT MaybeObject* SetProperty(String* key, |
| 1263 Object* value, |
| 1264 PropertyAttributes attributes, |
| 1265 StrictModeFlag strict_mode); |
| 1266 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, |
| 1267 String* key, |
| 1268 Object* value, |
| 1269 PropertyAttributes attributes, |
| 1270 StrictModeFlag strict_mode); |
| 1271 |
| 1272 // Returns the class name ([[Class]] property in the specification). |
| 1273 String* class_name(); |
| 1274 |
| 1275 // Returns the constructor name (the name (possibly, inferred name) of the |
| 1276 // function that was used to instantiate the object). |
| 1277 String* constructor_name(); |
| 1278 |
| 1279 inline PropertyAttributes GetPropertyAttribute(String* name); |
| 1280 PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver, |
| 1281 String* name); |
| 1282 PropertyAttributes GetLocalPropertyAttribute(String* name); |
| 1283 |
| 1284 // Can cause a GC. |
| 1285 bool HasProperty(String* name) { |
| 1286 return GetPropertyAttribute(name) != ABSENT; |
| 1287 } |
| 1288 |
| 1289 // Can cause a GC. |
| 1290 bool HasLocalProperty(String* name) { |
| 1291 return GetLocalPropertyAttribute(name) != ABSENT; |
| 1292 } |
| 1293 |
| 1294 // Return the object's prototype (might be Heap::null_value()). |
| 1295 inline Object* GetPrototype(); |
| 1296 |
| 1297 // Set the object's prototype (only JSReceiver and null are allowed). |
| 1298 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, |
| 1299 bool skip_hidden_prototypes); |
| 1300 |
| 1301 // Lookup a property. If found, the result is valid and has |
| 1302 // detailed information. |
| 1303 void LocalLookup(String* name, LookupResult* result); |
| 1304 void Lookup(String* name, LookupResult* result); |
| 1305 |
| 1306 private: |
| 1307 PropertyAttributes GetPropertyAttribute(JSReceiver* receiver, |
| 1308 LookupResult* result, |
| 1309 String* name, |
| 1310 bool continue_search); |
| 1311 |
| 1312 DISALLOW_IMPLICIT_CONSTRUCTORS(JSReceiver); |
| 1313 }; |
| 1314 |
| 1231 // The JSObject describes real heap allocated JavaScript objects with | 1315 // The JSObject describes real heap allocated JavaScript objects with |
| 1232 // properties. | 1316 // properties. |
| 1233 // Note that the map of JSObject changes during execution to enable inline | 1317 // Note that the map of JSObject changes during execution to enable inline |
| 1234 // caching. | 1318 // caching. |
| 1235 class JSObject: public HeapObject { | 1319 class JSObject: public JSReceiver { |
| 1236 public: | 1320 public: |
| 1237 enum DeleteMode { | 1321 enum DeleteMode { |
| 1238 NORMAL_DELETION, | 1322 NORMAL_DELETION, |
| 1239 STRICT_DELETION, | 1323 STRICT_DELETION, |
| 1240 FORCE_DELETION | 1324 FORCE_DELETION |
| 1241 }; | 1325 }; |
| 1242 | 1326 |
| 1243 enum ElementsKind { | 1327 enum ElementsKind { |
| 1244 // The only "fast" kind. | 1328 // The "fast" kind for tagged values. Must be first to make it possible |
| 1329 // to efficiently check maps if they have fast elements. |
| 1245 FAST_ELEMENTS, | 1330 FAST_ELEMENTS, |
| 1246 // All the kinds below are "slow". | 1331 |
| 1332 // The "fast" kind for unwrapped, non-tagged double values. |
| 1333 FAST_DOUBLE_ELEMENTS, |
| 1334 |
| 1335 // The "slow" kind. |
| 1247 DICTIONARY_ELEMENTS, | 1336 DICTIONARY_ELEMENTS, |
| 1337 NON_STRICT_ARGUMENTS_ELEMENTS, |
| 1338 // The "fast" kind for external arrays |
| 1248 EXTERNAL_BYTE_ELEMENTS, | 1339 EXTERNAL_BYTE_ELEMENTS, |
| 1249 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, | 1340 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, |
| 1250 EXTERNAL_SHORT_ELEMENTS, | 1341 EXTERNAL_SHORT_ELEMENTS, |
| 1251 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, | 1342 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, |
| 1252 EXTERNAL_INT_ELEMENTS, | 1343 EXTERNAL_INT_ELEMENTS, |
| 1253 EXTERNAL_UNSIGNED_INT_ELEMENTS, | 1344 EXTERNAL_UNSIGNED_INT_ELEMENTS, |
| 1254 EXTERNAL_FLOAT_ELEMENTS, | 1345 EXTERNAL_FLOAT_ELEMENTS, |
| 1255 EXTERNAL_DOUBLE_ELEMENTS, | 1346 EXTERNAL_DOUBLE_ELEMENTS, |
| 1256 EXTERNAL_PIXEL_ELEMENTS | 1347 EXTERNAL_PIXEL_ELEMENTS, |
| 1348 |
| 1349 // Derived constants from ElementsKind |
| 1350 FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_BYTE_ELEMENTS, |
| 1351 LAST_EXTERNAL_ARRAY_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS, |
| 1352 FIRST_ELEMENTS_KIND = FAST_ELEMENTS, |
| 1353 LAST_ELEMENTS_KIND = EXTERNAL_PIXEL_ELEMENTS |
| 1257 }; | 1354 }; |
| 1258 | 1355 |
| 1356 static const int kElementsKindCount = |
| 1357 LAST_ELEMENTS_KIND - FIRST_ELEMENTS_KIND + 1; |
| 1358 |
| 1259 // [properties]: Backing storage for properties. | 1359 // [properties]: Backing storage for properties. |
| 1260 // properties is a FixedArray in the fast case and a Dictionary in the | 1360 // properties is a FixedArray in the fast case and a Dictionary in the |
| 1261 // slow case. | 1361 // slow case. |
| 1262 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. | 1362 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. |
| 1263 inline void initialize_properties(); | 1363 inline void initialize_properties(); |
| 1264 inline bool HasFastProperties(); | 1364 inline bool HasFastProperties(); |
| 1265 inline StringDictionary* property_dictionary(); // Gets slow properties. | 1365 inline StringDictionary* property_dictionary(); // Gets slow properties. |
| 1266 | 1366 |
| 1267 // [elements]: The elements (properties with names that are integers). | 1367 // [elements]: The elements (properties with names that are integers). |
| 1268 // | 1368 // |
| 1269 // Elements can be in two general modes: fast and slow. Each mode | 1369 // Elements can be in two general modes: fast and slow. Each mode |
| 1270 // corrensponds to a set of object representations of elements that | 1370 // corrensponds to a set of object representations of elements that |
| 1271 // have something in common. | 1371 // have something in common. |
| 1272 // | 1372 // |
| 1273 // In the fast mode elements is a FixedArray and so each element can | 1373 // In the fast mode elements is a FixedArray and so each element can |
| 1274 // be quickly accessed. This fact is used in the generated code. The | 1374 // be quickly accessed. This fact is used in the generated code. The |
| 1275 // elements array can have one of the two maps in this mode: | 1375 // elements array can have one of three maps in this mode: |
| 1276 // fixed_array_map or fixed_cow_array_map (for copy-on-write | 1376 // fixed_array_map, non_strict_arguments_elements_map or |
| 1277 // arrays). In the latter case the elements array may be shared by a | 1377 // fixed_cow_array_map (for copy-on-write arrays). In the latter case |
| 1278 // few objects and so before writing to any element the array must | 1378 // the elements array may be shared by a few objects and so before |
| 1279 // be copied. Use EnsureWritableFastElements in this case. | 1379 // writing to any element the array must be copied. Use |
| 1380 // EnsureWritableFastElements in this case. |
| 1280 // | 1381 // |
| 1281 // In the slow mode elements is either a NumberDictionary or an ExternalArray. | 1382 // In the slow mode the elements is either a NumberDictionary, an |
| 1383 // ExternalArray, or a FixedArray parameter map for a (non-strict) |
| 1384 // arguments object. |
| 1282 DECL_ACCESSORS(elements, HeapObject) | 1385 DECL_ACCESSORS(elements, HeapObject) |
| 1283 inline void initialize_elements(); | 1386 inline void initialize_elements(); |
| 1284 MUST_USE_RESULT inline MaybeObject* ResetElements(); | 1387 MUST_USE_RESULT inline MaybeObject* ResetElements(); |
| 1285 inline ElementsKind GetElementsKind(); | 1388 inline ElementsKind GetElementsKind(); |
| 1286 inline bool HasFastElements(); | 1389 inline bool HasFastElements(); |
| 1390 inline bool HasFastDoubleElements(); |
| 1287 inline bool HasDictionaryElements(); | 1391 inline bool HasDictionaryElements(); |
| 1288 inline bool HasExternalPixelElements(); | 1392 inline bool HasExternalPixelElements(); |
| 1289 inline bool HasExternalArrayElements(); | 1393 inline bool HasExternalArrayElements(); |
| 1290 inline bool HasExternalByteElements(); | 1394 inline bool HasExternalByteElements(); |
| 1291 inline bool HasExternalUnsignedByteElements(); | 1395 inline bool HasExternalUnsignedByteElements(); |
| 1292 inline bool HasExternalShortElements(); | 1396 inline bool HasExternalShortElements(); |
| 1293 inline bool HasExternalUnsignedShortElements(); | 1397 inline bool HasExternalUnsignedShortElements(); |
| 1294 inline bool HasExternalIntElements(); | 1398 inline bool HasExternalIntElements(); |
| 1295 inline bool HasExternalUnsignedIntElements(); | 1399 inline bool HasExternalUnsignedIntElements(); |
| 1296 inline bool HasExternalFloatElements(); | 1400 inline bool HasExternalFloatElements(); |
| 1297 inline bool HasExternalDoubleElements(); | 1401 inline bool HasExternalDoubleElements(); |
| 1402 bool HasFastArgumentsElements(); |
| 1403 bool HasDictionaryArgumentsElements(); |
| 1298 inline bool AllowsSetElementsLength(); | 1404 inline bool AllowsSetElementsLength(); |
| 1299 inline NumberDictionary* element_dictionary(); // Gets slow elements. | 1405 inline NumberDictionary* element_dictionary(); // Gets slow elements. |
| 1300 // Requires: this->HasFastElements(). | 1406 |
| 1407 // Requires: HasFastElements(). |
| 1301 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); | 1408 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); |
| 1302 | 1409 |
| 1303 // Collects elements starting at index 0. | 1410 // Collects elements starting at index 0. |
| 1304 // Undefined values are placed after non-undefined values. | 1411 // Undefined values are placed after non-undefined values. |
| 1305 // Returns the number of non-undefined values. | 1412 // Returns the number of non-undefined values. |
| 1306 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); | 1413 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); |
| 1307 // As PrepareElementsForSort, but only on objects where elements is | 1414 // As PrepareElementsForSort, but only on objects where elements is |
| 1308 // a dictionary, and it will stay a dictionary. | 1415 // a dictionary, and it will stay a dictionary. |
| 1309 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); | 1416 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); |
| 1310 | 1417 |
| 1311 MUST_USE_RESULT MaybeObject* SetProperty(String* key, | 1418 MUST_USE_RESULT MaybeObject* SetPropertyForResult(LookupResult* result, |
| 1312 Object* value, | |
| 1313 PropertyAttributes attributes, | |
| 1314 StrictModeFlag strict_mode); | |
| 1315 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, | |
| 1316 String* key, | 1419 String* key, |
| 1317 Object* value, | 1420 Object* value, |
| 1318 PropertyAttributes attributes, | 1421 PropertyAttributes attributes, |
| 1319 StrictModeFlag strict_mode); | 1422 StrictModeFlag strict_mode); |
| 1320 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( | 1423 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( |
| 1321 LookupResult* result, | 1424 LookupResult* result, |
| 1322 String* name, | 1425 String* name, |
| 1323 Object* value, | 1426 Object* value, |
| 1324 bool check_prototype, | 1427 bool check_prototype, |
| 1325 StrictModeFlag strict_mode); | 1428 StrictModeFlag strict_mode); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 // Sets the property value in a normalized object given (key, value, details). | 1460 // Sets the property value in a normalized object given (key, value, details). |
| 1358 // Handles the special representation of JS global objects. | 1461 // Handles the special representation of JS global objects. |
| 1359 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(String* name, | 1462 MUST_USE_RESULT MaybeObject* SetNormalizedProperty(String* name, |
| 1360 Object* value, | 1463 Object* value, |
| 1361 PropertyDetails details); | 1464 PropertyDetails details); |
| 1362 | 1465 |
| 1363 // Deletes the named property in a normalized object. | 1466 // Deletes the named property in a normalized object. |
| 1364 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name, | 1467 MUST_USE_RESULT MaybeObject* DeleteNormalizedProperty(String* name, |
| 1365 DeleteMode mode); | 1468 DeleteMode mode); |
| 1366 | 1469 |
| 1367 // Returns the class name ([[Class]] property in the specification). | |
| 1368 String* class_name(); | |
| 1369 | |
| 1370 // Returns the constructor name (the name (possibly, inferred name) of the | |
| 1371 // function that was used to instantiate the object). | |
| 1372 String* constructor_name(); | |
| 1373 | |
| 1374 // Retrieve interceptors. | 1470 // Retrieve interceptors. |
| 1375 InterceptorInfo* GetNamedInterceptor(); | 1471 InterceptorInfo* GetNamedInterceptor(); |
| 1376 InterceptorInfo* GetIndexedInterceptor(); | 1472 InterceptorInfo* GetIndexedInterceptor(); |
| 1377 | 1473 |
| 1378 inline PropertyAttributes GetPropertyAttribute(String* name); | 1474 // Used from JSReceiver. |
| 1379 PropertyAttributes GetPropertyAttributeWithReceiver(JSObject* receiver, | 1475 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, |
| 1380 String* name); | 1476 String* name, |
| 1381 PropertyAttributes GetLocalPropertyAttribute(String* name); | 1477 bool continue_search); |
| 1478 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, |
| 1479 String* name, |
| 1480 bool continue_search); |
| 1481 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( |
| 1482 Object* receiver, |
| 1483 LookupResult* result, |
| 1484 String* name, |
| 1485 bool continue_search); |
| 1382 | 1486 |
| 1383 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, | 1487 MUST_USE_RESULT MaybeObject* DefineAccessor(String* name, |
| 1384 bool is_getter, | 1488 bool is_getter, |
| 1385 Object* fun, | 1489 Object* fun, |
| 1386 PropertyAttributes attributes); | 1490 PropertyAttributes attributes); |
| 1387 Object* LookupAccessor(String* name, bool is_getter); | 1491 Object* LookupAccessor(String* name, bool is_getter); |
| 1388 | 1492 |
| 1389 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); | 1493 MUST_USE_RESULT MaybeObject* DefineAccessor(AccessorInfo* info); |
| 1390 | 1494 |
| 1391 // Used from Object::GetProperty(). | 1495 // Used from Object::GetProperty(). |
| 1392 MaybeObject* GetPropertyWithFailedAccessCheck( | 1496 MaybeObject* GetPropertyWithFailedAccessCheck( |
| 1393 Object* receiver, | 1497 Object* receiver, |
| 1394 LookupResult* result, | 1498 LookupResult* result, |
| 1395 String* name, | 1499 String* name, |
| 1396 PropertyAttributes* attributes); | 1500 PropertyAttributes* attributes); |
| 1397 MaybeObject* GetPropertyWithInterceptor( | 1501 MaybeObject* GetPropertyWithInterceptor( |
| 1398 JSObject* receiver, | 1502 JSReceiver* receiver, |
| 1399 String* name, | 1503 String* name, |
| 1400 PropertyAttributes* attributes); | 1504 PropertyAttributes* attributes); |
| 1401 MaybeObject* GetPropertyPostInterceptor( | 1505 MaybeObject* GetPropertyPostInterceptor( |
| 1402 JSObject* receiver, | 1506 JSReceiver* receiver, |
| 1403 String* name, | 1507 String* name, |
| 1404 PropertyAttributes* attributes); | 1508 PropertyAttributes* attributes); |
| 1405 MaybeObject* GetLocalPropertyPostInterceptor(JSObject* receiver, | 1509 MaybeObject* GetLocalPropertyPostInterceptor(JSReceiver* receiver, |
| 1406 String* name, | 1510 String* name, |
| 1407 PropertyAttributes* attributes); | 1511 PropertyAttributes* attributes); |
| 1408 | 1512 |
| 1409 // Returns true if this is an instance of an api function and has | 1513 // Returns true if this is an instance of an api function and has |
| 1410 // been modified since it was created. May give false positives. | 1514 // been modified since it was created. May give false positives. |
| 1411 bool IsDirty(); | 1515 bool IsDirty(); |
| 1412 | 1516 |
| 1413 bool HasProperty(String* name) { | |
| 1414 return GetPropertyAttribute(name) != ABSENT; | |
| 1415 } | |
| 1416 | |
| 1417 // Can cause a GC if it hits an interceptor. | |
| 1418 bool HasLocalProperty(String* name) { | |
| 1419 return GetLocalPropertyAttribute(name) != ABSENT; | |
| 1420 } | |
| 1421 | |
| 1422 // If the receiver is a JSGlobalProxy this method will return its prototype, | 1517 // If the receiver is a JSGlobalProxy this method will return its prototype, |
| 1423 // otherwise the result is the receiver itself. | 1518 // otherwise the result is the receiver itself. |
| 1424 inline Object* BypassGlobalProxy(); | 1519 inline Object* BypassGlobalProxy(); |
| 1425 | 1520 |
| 1426 // Accessors for hidden properties object. | 1521 // Accessors for hidden properties object. |
| 1427 // | 1522 // |
| 1428 // Hidden properties are not local properties of the object itself. | 1523 // Hidden properties are not local properties of the object itself. |
| 1429 // Instead they are stored on an auxiliary JSObject stored as a local | 1524 // Instead they are stored on an auxiliary JSObject stored as a local |
| 1430 // property with a special name Heap::hidden_symbol(). But if the | 1525 // property with a special name Heap::hidden_symbol(). But if the |
| 1431 // receiver is a JSGlobalProxy then the auxiliary object is a property | 1526 // receiver is a JSGlobalProxy then the auxiliary object is a property |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1448 bool IsSimpleEnum(); | 1543 bool IsSimpleEnum(); |
| 1449 | 1544 |
| 1450 // Do we want to keep the elements in fast case when increasing the | 1545 // Do we want to keep the elements in fast case when increasing the |
| 1451 // capacity? | 1546 // capacity? |
| 1452 bool ShouldConvertToSlowElements(int new_capacity); | 1547 bool ShouldConvertToSlowElements(int new_capacity); |
| 1453 // Returns true if the backing storage for the slow-case elements of | 1548 // Returns true if the backing storage for the slow-case elements of |
| 1454 // this object takes up nearly as much space as a fast-case backing | 1549 // this object takes up nearly as much space as a fast-case backing |
| 1455 // storage would. In that case the JSObject should have fast | 1550 // storage would. In that case the JSObject should have fast |
| 1456 // elements. | 1551 // elements. |
| 1457 bool ShouldConvertToFastElements(); | 1552 bool ShouldConvertToFastElements(); |
| 1458 | 1553 // Returns true if the elements of JSObject contains only values that can be |
| 1459 // Return the object's prototype (might be Heap::null_value()). | 1554 // represented in a FixedDoubleArray. |
| 1460 inline Object* GetPrototype(); | 1555 bool ShouldConvertToFastDoubleElements(); |
| 1461 | |
| 1462 // Set the object's prototype (only JSObject and null are allowed). | |
| 1463 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, | |
| 1464 bool skip_hidden_prototypes); | |
| 1465 | 1556 |
| 1466 // Tells whether the index'th element is present. | 1557 // Tells whether the index'th element is present. |
| 1467 inline bool HasElement(uint32_t index); | 1558 inline bool HasElement(uint32_t index); |
| 1468 bool HasElementWithReceiver(JSObject* receiver, uint32_t index); | 1559 bool HasElementWithReceiver(JSReceiver* receiver, uint32_t index); |
| 1469 | 1560 |
| 1470 // Computes the new capacity when expanding the elements of a JSObject. | 1561 // Computes the new capacity when expanding the elements of a JSObject. |
| 1471 static int NewElementsCapacity(int old_capacity) { | 1562 static int NewElementsCapacity(int old_capacity) { |
| 1472 // (old_capacity + 50%) + 16 | 1563 // (old_capacity + 50%) + 16 |
| 1473 return old_capacity + (old_capacity >> 1) + 16; | 1564 return old_capacity + (old_capacity >> 1) + 16; |
| 1474 } | 1565 } |
| 1475 | 1566 |
| 1476 // Tells whether the index'th element is present and how it is stored. | 1567 // Tells whether the index'th element is present and how it is stored. |
| 1477 enum LocalElementType { | 1568 enum LocalElementType { |
| 1478 // There is no element with given index. | 1569 // There is no element with given index. |
| 1479 UNDEFINED_ELEMENT, | 1570 UNDEFINED_ELEMENT, |
| 1480 | 1571 |
| 1481 // Element with given index is handled by interceptor. | 1572 // Element with given index is handled by interceptor. |
| 1482 INTERCEPTED_ELEMENT, | 1573 INTERCEPTED_ELEMENT, |
| 1483 | 1574 |
| 1484 // Element with given index is character in string. | 1575 // Element with given index is character in string. |
| 1485 STRING_CHARACTER_ELEMENT, | 1576 STRING_CHARACTER_ELEMENT, |
| 1486 | 1577 |
| 1487 // Element with given index is stored in fast backing store. | 1578 // Element with given index is stored in fast backing store. |
| 1488 FAST_ELEMENT, | 1579 FAST_ELEMENT, |
| 1489 | 1580 |
| 1490 // Element with given index is stored in slow backing store. | 1581 // Element with given index is stored in slow backing store. |
| 1491 DICTIONARY_ELEMENT | 1582 DICTIONARY_ELEMENT |
| 1492 }; | 1583 }; |
| 1493 | 1584 |
| 1494 LocalElementType HasLocalElement(uint32_t index); | 1585 LocalElementType HasLocalElement(uint32_t index); |
| 1495 | 1586 |
| 1496 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); | 1587 bool HasElementWithInterceptor(JSReceiver* receiver, uint32_t index); |
| 1497 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); | 1588 bool HasElementPostInterceptor(JSReceiver* receiver, uint32_t index); |
| 1498 | 1589 |
| 1499 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, | 1590 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, |
| 1500 Object* value, | 1591 Object* value, |
| 1501 StrictModeFlag strict_mode, | 1592 StrictModeFlag strict_mode, |
| 1502 bool check_prototype = true); | 1593 bool check_prototype); |
| 1594 MUST_USE_RESULT MaybeObject* SetDictionaryElement(uint32_t index, |
| 1595 Object* value, |
| 1596 StrictModeFlag strict_mode, |
| 1597 bool check_prototype); |
| 1598 |
| 1599 MUST_USE_RESULT MaybeObject* SetFastDoubleElement( |
| 1600 uint32_t index, |
| 1601 Object* value, |
| 1602 StrictModeFlag strict_mode, |
| 1603 bool check_prototype = true); |
| 1503 | 1604 |
| 1504 // Set the index'th array element. | 1605 // Set the index'th array element. |
| 1505 // A Failure object is returned if GC is needed. | 1606 // A Failure object is returned if GC is needed. |
| 1506 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, | 1607 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, |
| 1507 Object* value, | 1608 Object* value, |
| 1508 StrictModeFlag strict_mode, | 1609 StrictModeFlag strict_mode, |
| 1509 bool check_prototype = true); | 1610 bool check_prototype); |
| 1510 | 1611 |
| 1511 // Returns the index'th element. | 1612 // Returns the index'th element. |
| 1512 // The undefined object if index is out of bounds. | 1613 // The undefined object if index is out of bounds. |
| 1513 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); | 1614 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index); |
| 1514 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); | 1615 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index); |
| 1515 | 1616 |
| 1516 // Get external element value at index if there is one and undefined | 1617 // Get external element value at index if there is one and undefined |
| 1517 // otherwise. Can return a failure if allocation of a heap number | 1618 // otherwise. Can return a failure if allocation of a heap number |
| 1518 // failed. | 1619 // failed. |
| 1519 MaybeObject* GetExternalElement(uint32_t index); | 1620 MaybeObject* GetExternalElement(uint32_t index); |
| 1520 | 1621 |
| 1622 // Replace the elements' backing store with fast elements of the given |
| 1623 // capacity. Update the length for JSArrays. Returns the new backing |
| 1624 // store. |
| 1521 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, | 1625 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, |
| 1522 int length); | 1626 int length); |
| 1627 MUST_USE_RESULT MaybeObject* SetFastDoubleElementsCapacityAndLength( |
| 1628 int capacity, |
| 1629 int length); |
| 1523 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); | 1630 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); |
| 1524 | 1631 |
| 1525 // Lookup interceptors are used for handling properties controlled by host | 1632 // Lookup interceptors are used for handling properties controlled by host |
| 1526 // objects. | 1633 // objects. |
| 1527 inline bool HasNamedInterceptor(); | 1634 inline bool HasNamedInterceptor(); |
| 1528 inline bool HasIndexedInterceptor(); | 1635 inline bool HasIndexedInterceptor(); |
| 1529 | 1636 |
| 1530 // Support functions for v8 api (needed for correct interceptor behavior). | 1637 // Support functions for v8 api (needed for correct interceptor behavior). |
| 1531 bool HasRealNamedProperty(String* key); | 1638 bool HasRealNamedProperty(String* key); |
| 1532 bool HasRealElementProperty(uint32_t index); | 1639 bool HasRealElementProperty(uint32_t index); |
| 1533 bool HasRealNamedCallbackProperty(String* key); | 1640 bool HasRealNamedCallbackProperty(String* key); |
| 1534 | 1641 |
| 1535 // Initializes the array to a certain length | 1642 // Initializes the array to a certain length |
| 1536 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); | 1643 MUST_USE_RESULT MaybeObject* SetElementsLength(Object* length); |
| 1537 | 1644 |
| 1538 // Get the header size for a JSObject. Used to compute the index of | 1645 // Get the header size for a JSObject. Used to compute the index of |
| 1539 // internal fields as well as the number of internal fields. | 1646 // internal fields as well as the number of internal fields. |
| 1540 inline int GetHeaderSize(); | 1647 inline int GetHeaderSize(); |
| 1541 | 1648 |
| 1542 inline int GetInternalFieldCount(); | 1649 inline int GetInternalFieldCount(); |
| 1543 inline int GetInternalFieldOffset(int index); | 1650 inline int GetInternalFieldOffset(int index); |
| 1544 inline Object* GetInternalField(int index); | 1651 inline Object* GetInternalField(int index); |
| 1545 inline void SetInternalField(int index, Object* value); | 1652 inline void SetInternalField(int index, Object* value); |
| 1546 | 1653 |
| 1547 // Lookup a property. If found, the result is valid and has | 1654 // Lookup a property. If found, the result is valid and has |
| 1548 // detailed information. | 1655 // detailed information. |
| 1549 void LocalLookup(String* name, LookupResult* result); | 1656 void LocalLookup(String* name, LookupResult* result); |
| 1550 void Lookup(String* name, LookupResult* result); | |
| 1551 | 1657 |
| 1552 // The following lookup functions skip interceptors. | 1658 // The following lookup functions skip interceptors. |
| 1553 void LocalLookupRealNamedProperty(String* name, LookupResult* result); | 1659 void LocalLookupRealNamedProperty(String* name, LookupResult* result); |
| 1554 void LookupRealNamedProperty(String* name, LookupResult* result); | 1660 void LookupRealNamedProperty(String* name, LookupResult* result); |
| 1555 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); | 1661 void LookupRealNamedPropertyInPrototypes(String* name, LookupResult* result); |
| 1556 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); | 1662 void LookupCallbackSetterInPrototypes(String* name, LookupResult* result); |
| 1557 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( | 1663 MUST_USE_RESULT MaybeObject* SetElementWithCallbackSetterInPrototypes( |
| 1558 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode); | 1664 uint32_t index, Object* value, bool* found, StrictModeFlag strict_mode); |
| 1559 void LookupCallback(String* name, LookupResult* result); | 1665 void LookupCallback(String* name, LookupResult* result); |
| 1560 | 1666 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1638 PropertyAttributes attributes, | 1744 PropertyAttributes attributes, |
| 1639 StrictModeFlag strict_mode); | 1745 StrictModeFlag strict_mode); |
| 1640 | 1746 |
| 1641 // Convert the object to use the canonical dictionary | 1747 // Convert the object to use the canonical dictionary |
| 1642 // representation. If the object is expected to have additional properties | 1748 // representation. If the object is expected to have additional properties |
| 1643 // added this number can be indicated to have the backing store allocated to | 1749 // added this number can be indicated to have the backing store allocated to |
| 1644 // an initial capacity for holding these properties. | 1750 // an initial capacity for holding these properties. |
| 1645 MUST_USE_RESULT MaybeObject* NormalizeProperties( | 1751 MUST_USE_RESULT MaybeObject* NormalizeProperties( |
| 1646 PropertyNormalizationMode mode, | 1752 PropertyNormalizationMode mode, |
| 1647 int expected_additional_properties); | 1753 int expected_additional_properties); |
| 1754 |
| 1755 // Convert and update the elements backing store to be a NumberDictionary |
| 1756 // dictionary. Returns the backing after conversion. |
| 1648 MUST_USE_RESULT MaybeObject* NormalizeElements(); | 1757 MUST_USE_RESULT MaybeObject* NormalizeElements(); |
| 1649 | 1758 |
| 1650 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); | 1759 MUST_USE_RESULT MaybeObject* UpdateMapCodeCache(String* name, Code* code); |
| 1651 | 1760 |
| 1652 // Transform slow named properties to fast variants. | 1761 // Transform slow named properties to fast variants. |
| 1653 // Returns failure if allocation failed. | 1762 // Returns failure if allocation failed. |
| 1654 MUST_USE_RESULT MaybeObject* TransformToFastProperties( | 1763 MUST_USE_RESULT MaybeObject* TransformToFastProperties( |
| 1655 int unused_property_fields); | 1764 int unused_property_fields); |
| 1656 | 1765 |
| 1657 // Access fast-case object properties at index. | 1766 // Access fast-case object properties at index. |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index); | 1892 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index); |
| 1784 | 1893 |
| 1785 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, | 1894 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, |
| 1786 DeleteMode mode); | 1895 DeleteMode mode); |
| 1787 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); | 1896 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); |
| 1788 | 1897 |
| 1789 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, | 1898 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, |
| 1790 DeleteMode mode); | 1899 DeleteMode mode); |
| 1791 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); | 1900 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); |
| 1792 | 1901 |
| 1793 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, | 1902 MUST_USE_RESULT MaybeObject* DeleteFastElement(uint32_t index); |
| 1794 String* name, | 1903 MUST_USE_RESULT MaybeObject* DeleteDictionaryElement(uint32_t index, |
| 1795 bool continue_search); | 1904 DeleteMode mode); |
| 1796 PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject* receiver, | 1905 |
| 1797 String* name, | 1906 bool ReferencesObjectFromElements(FixedArray* elements, |
| 1798 bool continue_search); | 1907 ElementsKind kind, |
| 1799 PropertyAttributes GetPropertyAttributeWithFailedAccessCheck( | 1908 Object* object); |
| 1800 Object* receiver, | 1909 bool HasElementInElements(FixedArray* elements, |
| 1801 LookupResult* result, | 1910 ElementsKind kind, |
| 1802 String* name, | 1911 uint32_t index); |
| 1803 bool continue_search); | |
| 1804 PropertyAttributes GetPropertyAttribute(JSObject* receiver, | |
| 1805 LookupResult* result, | |
| 1806 String* name, | |
| 1807 bool continue_search); | |
| 1808 | 1912 |
| 1809 // Returns true if most of the elements backing storage is used. | 1913 // Returns true if most of the elements backing storage is used. |
| 1810 bool HasDenseElements(); | 1914 bool HasDenseElements(); |
| 1811 | 1915 |
| 1812 bool CanSetCallback(String* name); | 1916 bool CanSetCallback(String* name); |
| 1813 MUST_USE_RESULT MaybeObject* SetElementCallback( | 1917 MUST_USE_RESULT MaybeObject* SetElementCallback( |
| 1814 uint32_t index, | 1918 uint32_t index, |
| 1815 Object* structure, | 1919 Object* structure, |
| 1816 PropertyAttributes attributes); | 1920 PropertyAttributes attributes); |
| 1817 MUST_USE_RESULT MaybeObject* SetPropertyCallback( | 1921 MUST_USE_RESULT MaybeObject* SetPropertyCallback( |
| 1818 String* name, | 1922 String* name, |
| 1819 Object* structure, | 1923 Object* structure, |
| 1820 PropertyAttributes attributes); | 1924 PropertyAttributes attributes); |
| 1821 MUST_USE_RESULT MaybeObject* DefineGetterSetter( | 1925 MUST_USE_RESULT MaybeObject* DefineGetterSetter( |
| 1822 String* name, | 1926 String* name, |
| 1823 PropertyAttributes attributes); | 1927 PropertyAttributes attributes); |
| 1824 | 1928 |
| 1825 void LookupInDescriptor(String* name, LookupResult* result); | 1929 void LookupInDescriptor(String* name, LookupResult* result); |
| 1826 | 1930 |
| 1827 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); | 1931 DISALLOW_IMPLICIT_CONSTRUCTORS(JSObject); |
| 1828 }; | 1932 }; |
| 1829 | 1933 |
| 1830 | 1934 |
| 1831 // FixedArray describes fixed-sized arrays with element type Object*. | 1935 // Common superclass for FixedArrays that allow implementations to share |
| 1832 class FixedArray: public HeapObject { | 1936 // common accessors and some code paths. |
| 1937 class FixedArrayBase: public HeapObject { |
| 1833 public: | 1938 public: |
| 1834 // [length]: length of the array. | 1939 // [length]: length of the array. |
| 1835 inline int length(); | 1940 inline int length(); |
| 1836 inline void set_length(int value); | 1941 inline void set_length(int value); |
| 1837 | 1942 |
| 1943 inline static FixedArrayBase* cast(Object* object); |
| 1944 |
| 1945 // Layout description. |
| 1946 // Length is smi tagged when it is stored. |
| 1947 static const int kLengthOffset = HeapObject::kHeaderSize; |
| 1948 static const int kHeaderSize = kLengthOffset + kPointerSize; |
| 1949 }; |
| 1950 |
| 1951 |
| 1952 // FixedArray describes fixed-sized arrays with element type Object*. |
| 1953 class FixedArray: public FixedArrayBase { |
| 1954 public: |
| 1838 // Setter and getter for elements. | 1955 // Setter and getter for elements. |
| 1839 inline Object* get(int index); | 1956 inline Object* get(int index); |
| 1840 // Setter that uses write barrier. | 1957 // Setter that uses write barrier. |
| 1841 inline void set(int index, Object* value); | 1958 inline void set(int index, Object* value); |
| 1842 | 1959 |
| 1843 // Setter that doesn't need write barrier). | 1960 // Setter that doesn't need write barrier). |
| 1844 inline void set(int index, Smi* value); | 1961 inline void set(int index, Smi* value); |
| 1845 // Setter with explicit barrier mode. | 1962 // Setter with explicit barrier mode. |
| 1846 inline void set(int index, Object* value, WriteBarrierMode mode); | 1963 inline void set(int index, Object* value, WriteBarrierMode mode); |
| 1847 | 1964 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1878 | 1995 |
| 1879 // Garbage collection support. | 1996 // Garbage collection support. |
| 1880 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } | 1997 static int SizeFor(int length) { return kHeaderSize + length * kPointerSize; } |
| 1881 | 1998 |
| 1882 // Code Generation support. | 1999 // Code Generation support. |
| 1883 static int OffsetOfElementAt(int index) { return SizeFor(index); } | 2000 static int OffsetOfElementAt(int index) { return SizeFor(index); } |
| 1884 | 2001 |
| 1885 // Casting. | 2002 // Casting. |
| 1886 static inline FixedArray* cast(Object* obj); | 2003 static inline FixedArray* cast(Object* obj); |
| 1887 | 2004 |
| 1888 // Layout description. | |
| 1889 // Length is smi tagged when it is stored. | |
| 1890 static const int kLengthOffset = HeapObject::kHeaderSize; | |
| 1891 static const int kHeaderSize = kLengthOffset + kPointerSize; | |
| 1892 | |
| 1893 // Maximal allowed size, in bytes, of a single FixedArray. | 2005 // Maximal allowed size, in bytes, of a single FixedArray. |
| 1894 // Prevents overflowing size computations, as well as extreme memory | 2006 // Prevents overflowing size computations, as well as extreme memory |
| 1895 // consumption. | 2007 // consumption. |
| 1896 static const int kMaxSize = 512 * MB; | 2008 static const int kMaxSize = 512 * MB; |
| 1897 // Maximally allowed length of a FixedArray. | 2009 // Maximally allowed length of a FixedArray. |
| 1898 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; | 2010 static const int kMaxLength = (kMaxSize - kHeaderSize) / kPointerSize; |
| 1899 | 2011 |
| 1900 // Dispatched behavior. | 2012 // Dispatched behavior. |
| 1901 #ifdef OBJECT_PRINT | 2013 #ifdef OBJECT_PRINT |
| 1902 inline void FixedArrayPrint() { | 2014 inline void FixedArrayPrint() { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1930 protected: | 2042 protected: |
| 1931 // Set operation on FixedArray without using write barriers. Can | 2043 // Set operation on FixedArray without using write barriers. Can |
| 1932 // only be used for storing old space objects or smis. | 2044 // only be used for storing old space objects or smis. |
| 1933 static inline void fast_set(FixedArray* array, int index, Object* value); | 2045 static inline void fast_set(FixedArray* array, int index, Object* value); |
| 1934 | 2046 |
| 1935 private: | 2047 private: |
| 1936 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); | 2048 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedArray); |
| 1937 }; | 2049 }; |
| 1938 | 2050 |
| 1939 | 2051 |
| 2052 // FixedDoubleArray describes fixed-sized arrays with element type double. |
| 2053 class FixedDoubleArray: public FixedArrayBase { |
| 2054 public: |
| 2055 inline void Initialize(FixedArray* from); |
| 2056 inline void Initialize(FixedDoubleArray* from); |
| 2057 inline void Initialize(NumberDictionary* from); |
| 2058 |
| 2059 // Setter and getter for elements. |
| 2060 inline double get(int index); |
| 2061 inline void set(int index, double value); |
| 2062 inline void set_the_hole(int index); |
| 2063 |
| 2064 // Checking for the hole. |
| 2065 inline bool is_the_hole(int index); |
| 2066 |
| 2067 // Garbage collection support. |
| 2068 inline static int SizeFor(int length) { |
| 2069 return kHeaderSize + length * kDoubleSize; |
| 2070 } |
| 2071 |
| 2072 // The following can't be declared inline as const static |
| 2073 // because they're 64-bit. |
| 2074 static uint64_t kCanonicalNonHoleNanLower32; |
| 2075 static uint64_t kCanonicalNonHoleNanInt64; |
| 2076 static uint64_t kHoleNanInt64; |
| 2077 |
| 2078 inline static bool is_the_hole_nan(double value) { |
| 2079 return BitCast<uint64_t, double>(value) == kHoleNanInt64; |
| 2080 } |
| 2081 |
| 2082 inline static double hole_nan_as_double() { |
| 2083 return BitCast<double, uint64_t>(kHoleNanInt64); |
| 2084 } |
| 2085 |
| 2086 inline static double canonical_not_the_hole_nan_as_double() { |
| 2087 return BitCast<double, uint64_t>(kCanonicalNonHoleNanInt64); |
| 2088 } |
| 2089 |
| 2090 // Casting. |
| 2091 static inline FixedDoubleArray* cast(Object* obj); |
| 2092 |
| 2093 // Maximal allowed size, in bytes, of a single FixedDoubleArray. |
| 2094 // Prevents overflowing size computations, as well as extreme memory |
| 2095 // consumption. |
| 2096 static const int kMaxSize = 512 * MB; |
| 2097 // Maximally allowed length of a FixedArray. |
| 2098 static const int kMaxLength = (kMaxSize - kHeaderSize) / kDoubleSize; |
| 2099 |
| 2100 // Dispatched behavior. |
| 2101 #ifdef OBJECT_PRINT |
| 2102 inline void FixedDoubleArrayPrint() { |
| 2103 FixedDoubleArrayPrint(stdout); |
| 2104 } |
| 2105 void FixedDoubleArrayPrint(FILE* out); |
| 2106 #endif |
| 2107 |
| 2108 #ifdef DEBUG |
| 2109 void FixedDoubleArrayVerify(); |
| 2110 #endif |
| 2111 |
| 2112 private: |
| 2113 DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray); |
| 2114 }; |
| 2115 |
| 2116 |
| 1940 // DescriptorArrays are fixed arrays used to hold instance descriptors. | 2117 // DescriptorArrays are fixed arrays used to hold instance descriptors. |
| 1941 // The format of the these objects is: | 2118 // The format of the these objects is: |
| 1942 // TODO(1399): It should be possible to make room for bit_field3 in the map | 2119 // TODO(1399): It should be possible to make room for bit_field3 in the map |
| 1943 // without overloading the instance descriptors field in the map | 2120 // without overloading the instance descriptors field in the map |
| 1944 // (and storing it in the DescriptorArray when the map has one). | 2121 // (and storing it in the DescriptorArray when the map has one). |
| 1945 // [0]: storage for bit_field3 for Map owning this object (Smi) | 2122 // [0]: storage for bit_field3 for Map owning this object (Smi) |
| 1946 // [1]: point to a fixed array with (value, detail) pairs. | 2123 // [1]: point to a fixed array with (value, detail) pairs. |
| 1947 // [2]: next enumeration index (Smi), or pointer to small fixed array: | 2124 // [2]: next enumeration index (Smi), or pointer to small fixed array: |
| 1948 // [0]: next enumeration index (Smi) | 2125 // [0]: next enumeration index (Smi) |
| 1949 // [1]: pointer to fixed array with enum cache | 2126 // [1]: pointer to fixed array with enum cache |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2258 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex | 2435 // FixedArray. Staying below kMaxCapacity also ensures that EntryToIndex |
| 2259 // cannot overflow. | 2436 // cannot overflow. |
| 2260 static const int kMaxCapacity = | 2437 static const int kMaxCapacity = |
| 2261 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; | 2438 (FixedArray::kMaxLength - kElementsStartOffset) / kEntrySize; |
| 2262 | 2439 |
| 2263 // Find entry for key otherwise return kNotFound. | 2440 // Find entry for key otherwise return kNotFound. |
| 2264 inline int FindEntry(Key key); | 2441 inline int FindEntry(Key key); |
| 2265 int FindEntry(Isolate* isolate, Key key); | 2442 int FindEntry(Isolate* isolate, Key key); |
| 2266 | 2443 |
| 2267 protected: | 2444 protected: |
| 2268 | |
| 2269 // Find the entry at which to insert element with the given key that | 2445 // Find the entry at which to insert element with the given key that |
| 2270 // has the given hash value. | 2446 // has the given hash value. |
| 2271 uint32_t FindInsertionEntry(uint32_t hash); | 2447 uint32_t FindInsertionEntry(uint32_t hash); |
| 2272 | 2448 |
| 2273 // Returns the index for an entry (of the key) | 2449 // Returns the index for an entry (of the key) |
| 2274 static inline int EntryToIndex(int entry) { | 2450 static inline int EntryToIndex(int entry) { |
| 2275 return (entry * kEntrySize) + kElementsStartIndex; | 2451 return (entry * kEntrySize) + kElementsStartIndex; |
| 2276 } | 2452 } |
| 2277 | 2453 |
| 2278 // Update the number of elements in the hash table. | 2454 // Update the number of elements in the hash table. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2303 } | 2479 } |
| 2304 | 2480 |
| 2305 static uint32_t FirstProbe(uint32_t hash, uint32_t size) { | 2481 static uint32_t FirstProbe(uint32_t hash, uint32_t size) { |
| 2306 return hash & (size - 1); | 2482 return hash & (size - 1); |
| 2307 } | 2483 } |
| 2308 | 2484 |
| 2309 static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) { | 2485 static uint32_t NextProbe(uint32_t last, uint32_t number, uint32_t size) { |
| 2310 return (last + number) & (size - 1); | 2486 return (last + number) & (size - 1); |
| 2311 } | 2487 } |
| 2312 | 2488 |
| 2489 // Rehashes this hash-table into the new table. |
| 2490 MUST_USE_RESULT MaybeObject* Rehash(HashTable* new_table, Key key); |
| 2491 |
| 2492 // Attempt to shrink hash table after removal of key. |
| 2493 MUST_USE_RESULT MaybeObject* Shrink(Key key); |
| 2494 |
| 2313 // Ensure enough space for n additional elements. | 2495 // Ensure enough space for n additional elements. |
| 2314 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); | 2496 MUST_USE_RESULT MaybeObject* EnsureCapacity(int n, Key key); |
| 2315 }; | 2497 }; |
| 2316 | 2498 |
| 2317 | 2499 |
| 2318 | 2500 |
| 2319 // HashTableKey is an abstract superclass for virtual key behavior. | 2501 // HashTableKey is an abstract superclass for virtual key behavior. |
| 2320 class HashTableKey { | 2502 class HashTableKey { |
| 2321 public: | 2503 public: |
| 2322 // Returns whether the other object matches this key. | 2504 // Returns whether the other object matches this key. |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 static inline MapCache* cast(Object* obj); | 2607 static inline MapCache* cast(Object* obj); |
| 2426 | 2608 |
| 2427 private: | 2609 private: |
| 2428 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); | 2610 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); |
| 2429 }; | 2611 }; |
| 2430 | 2612 |
| 2431 | 2613 |
| 2432 template <typename Shape, typename Key> | 2614 template <typename Shape, typename Key> |
| 2433 class Dictionary: public HashTable<Shape, Key> { | 2615 class Dictionary: public HashTable<Shape, Key> { |
| 2434 public: | 2616 public: |
| 2435 | |
| 2436 static inline Dictionary<Shape, Key>* cast(Object* obj) { | 2617 static inline Dictionary<Shape, Key>* cast(Object* obj) { |
| 2437 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); | 2618 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); |
| 2438 } | 2619 } |
| 2439 | 2620 |
| 2440 // Returns the value at entry. | 2621 // Returns the value at entry. |
| 2441 Object* ValueAt(int entry) { | 2622 Object* ValueAt(int entry) { |
| 2442 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1); | 2623 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1); |
| 2443 } | 2624 } |
| 2444 | 2625 |
| 2445 // Set the value for entry. | 2626 // Set the value for entry. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2468 void DetailsAtPut(int entry, PropertyDetails value) { | 2649 void DetailsAtPut(int entry, PropertyDetails value) { |
| 2469 this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); | 2650 this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 2, value.AsSmi()); |
| 2470 } | 2651 } |
| 2471 | 2652 |
| 2472 // Sorting support | 2653 // Sorting support |
| 2473 void CopyValuesTo(FixedArray* elements); | 2654 void CopyValuesTo(FixedArray* elements); |
| 2474 | 2655 |
| 2475 // Delete a property from the dictionary. | 2656 // Delete a property from the dictionary. |
| 2476 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); | 2657 Object* DeleteProperty(int entry, JSObject::DeleteMode mode); |
| 2477 | 2658 |
| 2659 // Attempt to shrink the dictionary after deletion of key. |
| 2660 MUST_USE_RESULT MaybeObject* Shrink(Key key); |
| 2661 |
| 2478 // Returns the number of elements in the dictionary filtering out properties | 2662 // Returns the number of elements in the dictionary filtering out properties |
| 2479 // with the specified attributes. | 2663 // with the specified attributes. |
| 2480 int NumberOfElementsFilterAttributes(PropertyAttributes filter); | 2664 int NumberOfElementsFilterAttributes(PropertyAttributes filter); |
| 2481 | 2665 |
| 2482 // Returns the number of enumerable elements in the dictionary. | 2666 // Returns the number of enumerable elements in the dictionary. |
| 2483 int NumberOfEnumElements(); | 2667 int NumberOfEnumElements(); |
| 2484 | 2668 |
| 2669 enum SortMode { UNSORTED, SORTED }; |
| 2485 // Copies keys to preallocated fixed array. | 2670 // Copies keys to preallocated fixed array. |
| 2486 void CopyKeysTo(FixedArray* storage, PropertyAttributes filter); | 2671 void CopyKeysTo(FixedArray* storage, |
| 2672 PropertyAttributes filter, |
| 2673 SortMode sort_mode); |
| 2487 // Fill in details for properties into storage. | 2674 // Fill in details for properties into storage. |
| 2488 void CopyKeysTo(FixedArray* storage); | 2675 void CopyKeysTo(FixedArray* storage, SortMode sort_mode); |
| 2489 | 2676 |
| 2490 // Accessors for next enumeration index. | 2677 // Accessors for next enumeration index. |
| 2491 void SetNextEnumerationIndex(int index) { | 2678 void SetNextEnumerationIndex(int index) { |
| 2492 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); | 2679 this->fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index)); |
| 2493 } | 2680 } |
| 2494 | 2681 |
| 2495 int NextEnumerationIndex() { | 2682 int NextEnumerationIndex() { |
| 2496 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); | 2683 return Smi::cast(FixedArray::get(kNextEnumerationIndexIndex))->value(); |
| 2497 } | 2684 } |
| 2498 | 2685 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 PropertyNormalizationMode mode); | 2866 PropertyNormalizationMode mode); |
| 2680 | 2867 |
| 2681 void Clear(); | 2868 void Clear(); |
| 2682 | 2869 |
| 2683 // Casting | 2870 // Casting |
| 2684 static inline NormalizedMapCache* cast(Object* obj); | 2871 static inline NormalizedMapCache* cast(Object* obj); |
| 2685 | 2872 |
| 2686 #ifdef DEBUG | 2873 #ifdef DEBUG |
| 2687 void NormalizedMapCacheVerify(); | 2874 void NormalizedMapCacheVerify(); |
| 2688 #endif | 2875 #endif |
| 2689 | |
| 2690 private: | |
| 2691 static int Hash(Map* fast); | |
| 2692 | |
| 2693 static bool CheckHit(Map* slow, Map* fast, PropertyNormalizationMode mode); | |
| 2694 }; | 2876 }; |
| 2695 | 2877 |
| 2696 | 2878 |
| 2697 // ByteArray represents fixed sized byte arrays. Used for the relocation info | 2879 // ByteArray represents fixed sized byte arrays. Used for the relocation info |
| 2698 // that is attached to code objects. | 2880 // that is attached to code objects. |
| 2699 class ByteArray: public HeapObject { | 2881 class ByteArray: public HeapObject { |
| 2700 public: | 2882 public: |
| 2701 // [length]: length of the array. | 2883 // [length]: length of the array. |
| 2702 inline int length(); | 2884 inline int length(); |
| 2703 inline void set_length(int value); | 2885 inline void set_length(int value); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3167 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; | 3349 return (length() - kFirstDeoptEntryIndex) / kDeoptEntrySize; |
| 3168 } | 3350 } |
| 3169 | 3351 |
| 3170 // Allocates a DeoptimizationInputData. | 3352 // Allocates a DeoptimizationInputData. |
| 3171 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, | 3353 MUST_USE_RESULT static MaybeObject* Allocate(int deopt_entry_count, |
| 3172 PretenureFlag pretenure); | 3354 PretenureFlag pretenure); |
| 3173 | 3355 |
| 3174 // Casting. | 3356 // Casting. |
| 3175 static inline DeoptimizationInputData* cast(Object* obj); | 3357 static inline DeoptimizationInputData* cast(Object* obj); |
| 3176 | 3358 |
| 3177 #ifdef OBJECT_PRINT | 3359 #ifdef ENABLE_DISASSEMBLER |
| 3178 void DeoptimizationInputDataPrint(FILE* out); | 3360 void DeoptimizationInputDataPrint(FILE* out); |
| 3179 #endif | 3361 #endif |
| 3180 | 3362 |
| 3181 private: | 3363 private: |
| 3182 static int IndexForEntry(int i) { | 3364 static int IndexForEntry(int i) { |
| 3183 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); | 3365 return kFirstDeoptEntryIndex + (i * kDeoptEntrySize); |
| 3184 } | 3366 } |
| 3185 | 3367 |
| 3186 static int LengthFor(int entry_count) { | 3368 static int LengthFor(int entry_count) { |
| 3187 return IndexForEntry(entry_count); | 3369 return IndexForEntry(entry_count); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3206 return deopt_points * 2; | 3388 return deopt_points * 2; |
| 3207 } | 3389 } |
| 3208 | 3390 |
| 3209 // Allocates a DeoptimizationOutputData. | 3391 // Allocates a DeoptimizationOutputData. |
| 3210 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, | 3392 MUST_USE_RESULT static MaybeObject* Allocate(int number_of_deopt_points, |
| 3211 PretenureFlag pretenure); | 3393 PretenureFlag pretenure); |
| 3212 | 3394 |
| 3213 // Casting. | 3395 // Casting. |
| 3214 static inline DeoptimizationOutputData* cast(Object* obj); | 3396 static inline DeoptimizationOutputData* cast(Object* obj); |
| 3215 | 3397 |
| 3216 #ifdef OBJECT_PRINT | 3398 #if defined(OBJECT_PRINT) || defined(ENABLE_DISASSEMBLER) |
| 3217 void DeoptimizationOutputDataPrint(FILE* out); | 3399 void DeoptimizationOutputDataPrint(FILE* out); |
| 3218 #endif | 3400 #endif |
| 3219 }; | 3401 }; |
| 3220 | 3402 |
| 3221 | 3403 |
| 3222 class SafepointEntry; | 3404 class SafepointEntry; |
| 3223 | 3405 |
| 3224 | 3406 |
| 3225 // Code describes objects with on-the-fly generated machine code. | 3407 // Code describes objects with on-the-fly generated machine code. |
| 3226 class Code: public HeapObject { | 3408 class Code: public HeapObject { |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3361 // [stack_check_table_start]: For kind FUNCTION, the offset in the | 3543 // [stack_check_table_start]: For kind FUNCTION, the offset in the |
| 3362 // instruction stream where the stack check table starts. | 3544 // instruction stream where the stack check table starts. |
| 3363 inline unsigned stack_check_table_offset(); | 3545 inline unsigned stack_check_table_offset(); |
| 3364 inline void set_stack_check_table_offset(unsigned offset); | 3546 inline void set_stack_check_table_offset(unsigned offset); |
| 3365 | 3547 |
| 3366 // [check type]: For kind CALL_IC, tells how to check if the | 3548 // [check type]: For kind CALL_IC, tells how to check if the |
| 3367 // receiver is valid for the given call. | 3549 // receiver is valid for the given call. |
| 3368 inline CheckType check_type(); | 3550 inline CheckType check_type(); |
| 3369 inline void set_check_type(CheckType value); | 3551 inline void set_check_type(CheckType value); |
| 3370 | 3552 |
| 3371 // [external array type]: For kind KEYED_EXTERNAL_ARRAY_LOAD_IC and | |
| 3372 // KEYED_EXTERNAL_ARRAY_STORE_IC, identifies the type of external | |
| 3373 // array that the code stub is specialized for. | |
| 3374 inline ExternalArrayType external_array_type(); | |
| 3375 inline void set_external_array_type(ExternalArrayType value); | |
| 3376 | |
| 3377 // [type-recording unary op type]: For all UNARY_OP_IC. | 3553 // [type-recording unary op type]: For all UNARY_OP_IC. |
| 3378 inline byte unary_op_type(); | 3554 inline byte unary_op_type(); |
| 3379 inline void set_unary_op_type(byte value); | 3555 inline void set_unary_op_type(byte value); |
| 3380 | 3556 |
| 3381 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC. | 3557 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC. |
| 3382 inline byte binary_op_type(); | 3558 inline byte binary_op_type(); |
| 3383 inline void set_binary_op_type(byte value); | 3559 inline void set_binary_op_type(byte value); |
| 3384 inline byte binary_op_result_type(); | 3560 inline byte binary_op_result_type(); |
| 3385 inline void set_binary_op_result_type(byte value); | 3561 inline void set_binary_op_result_type(byte value); |
| 3386 | 3562 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3518 // Add padding to align the instruction start following right after | 3694 // Add padding to align the instruction start following right after |
| 3519 // the Code object header. | 3695 // the Code object header. |
| 3520 static const int kHeaderSize = | 3696 static const int kHeaderSize = |
| 3521 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; | 3697 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; |
| 3522 | 3698 |
| 3523 // Byte offsets within kKindSpecificFlagsOffset. | 3699 // Byte offsets within kKindSpecificFlagsOffset. |
| 3524 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; | 3700 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; |
| 3525 static const int kOptimizableOffset = kKindSpecificFlagsOffset; | 3701 static const int kOptimizableOffset = kKindSpecificFlagsOffset; |
| 3526 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; | 3702 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; |
| 3527 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; | 3703 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; |
| 3528 static const int kExternalArrayTypeOffset = kKindSpecificFlagsOffset; | |
| 3529 | 3704 |
| 3530 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; | 3705 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; |
| 3531 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; | 3706 static const int kUnaryOpTypeOffset = kStubMajorKeyOffset + 1; |
| 3532 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; | 3707 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; |
| 3533 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; | 3708 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; |
| 3534 | 3709 |
| 3535 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; | 3710 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; |
| 3536 static const int kAllowOSRAtLoopNestingLevelOffset = | 3711 static const int kAllowOSRAtLoopNestingLevelOffset = |
| 3537 kHasDeoptimizationSupportOffset + 1; | 3712 kHasDeoptimizationSupportOffset + 1; |
| 3538 | 3713 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3669 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); | 3844 set_bit_field(bit_field() | (1 << kHasInstanceCallHandler)); |
| 3670 } | 3845 } |
| 3671 | 3846 |
| 3672 inline bool has_instance_call_handler() { | 3847 inline bool has_instance_call_handler() { |
| 3673 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; | 3848 return ((1 << kHasInstanceCallHandler) & bit_field()) != 0; |
| 3674 } | 3849 } |
| 3675 | 3850 |
| 3676 inline void set_is_extensible(bool value); | 3851 inline void set_is_extensible(bool value); |
| 3677 inline bool is_extensible(); | 3852 inline bool is_extensible(); |
| 3678 | 3853 |
| 3854 inline void set_elements_kind(JSObject::ElementsKind elements_kind) { |
| 3855 ASSERT(elements_kind < JSObject::kElementsKindCount); |
| 3856 ASSERT(JSObject::kElementsKindCount <= (1 << kElementsKindBitCount)); |
| 3857 set_bit_field2((bit_field2() & ~kElementsKindMask) | |
| 3858 (elements_kind << kElementsKindShift)); |
| 3859 ASSERT(this->elements_kind() == elements_kind); |
| 3860 } |
| 3861 |
| 3862 inline JSObject::ElementsKind elements_kind() { |
| 3863 return static_cast<JSObject::ElementsKind>( |
| 3864 (bit_field2() & kElementsKindMask) >> kElementsKindShift); |
| 3865 } |
| 3866 |
| 3679 // Tells whether the instance has fast elements. | 3867 // Tells whether the instance has fast elements. |
| 3680 // Equivalent to instance->GetElementsKind() == FAST_ELEMENTS. | 3868 // Equivalent to instance->GetElementsKind() == FAST_ELEMENTS. |
| 3681 inline void set_has_fast_elements(bool value) { | 3869 inline bool has_fast_elements() { |
| 3682 if (value) { | 3870 return elements_kind() == JSObject::FAST_ELEMENTS; |
| 3683 set_bit_field2(bit_field2() | (1 << kHasFastElements)); | |
| 3684 } else { | |
| 3685 set_bit_field2(bit_field2() & ~(1 << kHasFastElements)); | |
| 3686 } | |
| 3687 } | 3871 } |
| 3688 | 3872 |
| 3689 inline bool has_fast_elements() { | 3873 inline bool has_fast_double_elements() { |
| 3690 return ((1 << kHasFastElements) & bit_field2()) != 0; | 3874 return elements_kind() == JSObject::FAST_DOUBLE_ELEMENTS; |
| 3691 } | |
| 3692 | |
| 3693 // Tells whether an instance has pixel array elements. | |
| 3694 inline void set_has_external_array_elements(bool value) { | |
| 3695 if (value) { | |
| 3696 set_bit_field2(bit_field2() | (1 << kHasExternalArrayElements)); | |
| 3697 } else { | |
| 3698 set_bit_field2(bit_field2() & ~(1 << kHasExternalArrayElements)); | |
| 3699 } | |
| 3700 } | 3875 } |
| 3701 | 3876 |
| 3702 inline bool has_external_array_elements() { | 3877 inline bool has_external_array_elements() { |
| 3703 return ((1 << kHasExternalArrayElements) & bit_field2()) != 0; | 3878 JSObject::ElementsKind kind(elements_kind()); |
| 3879 return kind >= JSObject::FIRST_EXTERNAL_ARRAY_ELEMENTS_KIND && |
| 3880 kind <= JSObject::LAST_EXTERNAL_ARRAY_ELEMENTS_KIND; |
| 3881 } |
| 3882 |
| 3883 inline bool has_dictionary_elements() { |
| 3884 return elements_kind() == JSObject::DICTIONARY_ELEMENTS; |
| 3704 } | 3885 } |
| 3705 | 3886 |
| 3706 // Tells whether the map is attached to SharedFunctionInfo | 3887 // Tells whether the map is attached to SharedFunctionInfo |
| 3707 // (for inobject slack tracking). | 3888 // (for inobject slack tracking). |
| 3708 inline void set_attached_to_shared_function_info(bool value); | 3889 inline void set_attached_to_shared_function_info(bool value); |
| 3709 | 3890 |
| 3710 inline bool attached_to_shared_function_info(); | 3891 inline bool attached_to_shared_function_info(); |
| 3711 | 3892 |
| 3712 // Tells whether the map is shared between objects that may have different | 3893 // Tells whether the map is shared between objects that may have different |
| 3713 // behavior. If true, the map should never be modified, instead a clone | 3894 // behavior. If true, the map should never be modified, instead a clone |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3745 | 3926 |
| 3746 // [prototype transitions]: cache of prototype transitions. | 3927 // [prototype transitions]: cache of prototype transitions. |
| 3747 // Prototype transition is a transition that happens | 3928 // Prototype transition is a transition that happens |
| 3748 // when we change object's prototype to a new one. | 3929 // when we change object's prototype to a new one. |
| 3749 // Cache format: | 3930 // Cache format: |
| 3750 // 0: finger - index of the first free cell in the cache | 3931 // 0: finger - index of the first free cell in the cache |
| 3751 // 1 + 2 * i: prototype | 3932 // 1 + 2 * i: prototype |
| 3752 // 2 + 2 * i: target map | 3933 // 2 + 2 * i: target map |
| 3753 DECL_ACCESSORS(prototype_transitions, FixedArray) | 3934 DECL_ACCESSORS(prototype_transitions, FixedArray) |
| 3754 | 3935 |
| 3936 inline FixedArray* unchecked_prototype_transitions(); |
| 3937 |
| 3938 static const int kProtoTransitionHeaderSize = 1; |
| 3939 static const int kProtoTransitionNumberOfEntriesOffset = 0; |
| 3940 static const int kProtoTransitionElementsPerEntry = 2; |
| 3941 static const int kProtoTransitionPrototypeOffset = 0; |
| 3942 static const int kProtoTransitionMapOffset = 1; |
| 3943 |
| 3944 inline int NumberOfProtoTransitions() { |
| 3945 FixedArray* cache = prototype_transitions(); |
| 3946 if (cache->length() == 0) return 0; |
| 3947 return |
| 3948 Smi::cast(cache->get(kProtoTransitionNumberOfEntriesOffset))->value(); |
| 3949 } |
| 3950 |
| 3951 inline void SetNumberOfProtoTransitions(int value) { |
| 3952 FixedArray* cache = prototype_transitions(); |
| 3953 ASSERT(cache->length() != 0); |
| 3954 cache->set_unchecked(kProtoTransitionNumberOfEntriesOffset, |
| 3955 Smi::FromInt(value)); |
| 3956 } |
| 3957 |
| 3755 // Lookup in the map's instance descriptors and fill out the result | 3958 // Lookup in the map's instance descriptors and fill out the result |
| 3756 // with the given holder if the name is found. The holder may be | 3959 // with the given holder if the name is found. The holder may be |
| 3757 // NULL when this function is used from the compiler. | 3960 // NULL when this function is used from the compiler. |
| 3758 void LookupInDescriptors(JSObject* holder, | 3961 void LookupInDescriptors(JSObject* holder, |
| 3759 String* name, | 3962 String* name, |
| 3760 LookupResult* result); | 3963 LookupResult* result); |
| 3761 | 3964 |
| 3762 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); | 3965 MUST_USE_RESULT MaybeObject* CopyDropDescriptors(); |
| 3763 | 3966 |
| 3764 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, | 3967 MUST_USE_RESULT MaybeObject* CopyNormalized(PropertyNormalizationMode mode, |
| 3765 NormalizedMapSharingMode sharing); | 3968 NormalizedMapSharingMode sharing); |
| 3766 | 3969 |
| 3767 // Returns a copy of the map, with all transitions dropped from the | 3970 // Returns a copy of the map, with all transitions dropped from the |
| 3768 // instance descriptors. | 3971 // instance descriptors. |
| 3769 MUST_USE_RESULT MaybeObject* CopyDropTransitions(); | 3972 MUST_USE_RESULT MaybeObject* CopyDropTransitions(); |
| 3770 | 3973 |
| 3771 // Returns this map if it has the fast elements bit set, otherwise | 3974 // Returns this map if it already has elements that are fast, otherwise |
| 3772 // returns a copy of the map, with all transitions dropped from the | 3975 // returns a copy of the map, with all transitions dropped from the |
| 3773 // descriptors and the fast elements bit set. | 3976 // descriptors and the ElementsKind set to FAST_ELEMENTS. |
| 3774 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); | 3977 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); |
| 3775 | 3978 |
| 3776 // Returns this map if it has the fast elements bit cleared, | 3979 // Returns this map if it already has fast elements that are doubles, |
| 3777 // otherwise returns a copy of the map, with all transitions dropped | 3980 // otherwise returns a copy of the map, with all transitions dropped from the |
| 3778 // from the descriptors and the fast elements bit cleared. | 3981 // descriptors and the ElementsKind set to FAST_DOUBLE_ELEMENTS. |
| 3982 MUST_USE_RESULT inline MaybeObject* GetFastDoubleElementsMap(); |
| 3983 |
| 3984 // Returns this map if already has dictionary elements, otherwise returns a |
| 3985 // copy of the map, with all transitions dropped from the descriptors and the |
| 3986 // ElementsKind set to DICTIONARY_ELEMENTS. |
| 3779 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); | 3987 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); |
| 3780 | 3988 |
| 3781 // Returns a new map with all transitions dropped from the descriptors and the | 3989 // Returns a new map with all transitions dropped from the descriptors and the |
| 3782 // external array elements bit set. | 3990 // ElementsKind set to one of the value corresponding to array_type. |
| 3783 MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap( | 3991 MUST_USE_RESULT MaybeObject* GetExternalArrayElementsMap( |
| 3784 ExternalArrayType array_type, | 3992 ExternalArrayType array_type, |
| 3785 bool safe_to_add_transition); | 3993 bool safe_to_add_transition); |
| 3786 | 3994 |
| 3787 // Returns the property index for name (only valid for FAST MODE). | 3995 // Returns the property index for name (only valid for FAST MODE). |
| 3788 int PropertyIndexFor(String* name); | 3996 int PropertyIndexFor(String* name); |
| 3789 | 3997 |
| 3790 // Returns the next free property index (only valid for FAST MODE). | 3998 // Returns the next free property index (only valid for FAST MODE). |
| 3791 int NextFreePropertyIndex(); | 3999 int NextFreePropertyIndex(); |
| 3792 | 4000 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 3821 // target's prototype pointer point back to this map. | 4029 // target's prototype pointer point back to this map. |
| 3822 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). | 4030 // This is undone in MarkCompactCollector::ClearNonLiveTransitions(). |
| 3823 void CreateBackPointers(); | 4031 void CreateBackPointers(); |
| 3824 | 4032 |
| 3825 // Set all map transitions from this map to dead maps to null. | 4033 // Set all map transitions from this map to dead maps to null. |
| 3826 // Also, restore the original prototype on the targets of these | 4034 // Also, restore the original prototype on the targets of these |
| 3827 // transitions, so that we do not process this map again while | 4035 // transitions, so that we do not process this map again while |
| 3828 // following back pointers. | 4036 // following back pointers. |
| 3829 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); | 4037 void ClearNonLiveTransitions(Heap* heap, Object* real_prototype); |
| 3830 | 4038 |
| 4039 // Computes a hash value for this map, to be used in HashTables and such. |
| 4040 int Hash(); |
| 4041 |
| 4042 // Compares this map to another to see if they describe equivalent objects. |
| 4043 // If |mode| is set to CLEAR_INOBJECT_PROPERTIES, |other| is treated as if |
| 4044 // it had exactly zero inobject properties. |
| 4045 // The "shared" flags of both this map and |other| are ignored. |
| 4046 bool EquivalentToForNormalization(Map* other, PropertyNormalizationMode mode); |
| 4047 |
| 4048 // Returns true if this map and |other| describe equivalent objects. |
| 4049 // The "shared" flags of both this map and |other| are ignored. |
| 4050 bool EquivalentTo(Map* other) { |
| 4051 return EquivalentToForNormalization(other, KEEP_INOBJECT_PROPERTIES); |
| 4052 } |
| 4053 |
| 3831 // Dispatched behavior. | 4054 // Dispatched behavior. |
| 3832 #ifdef OBJECT_PRINT | 4055 #ifdef OBJECT_PRINT |
| 3833 inline void MapPrint() { | 4056 inline void MapPrint() { |
| 3834 MapPrint(stdout); | 4057 MapPrint(stdout); |
| 3835 } | 4058 } |
| 3836 void MapPrint(FILE* out); | 4059 void MapPrint(FILE* out); |
| 3837 #endif | 4060 #endif |
| 3838 #ifdef DEBUG | 4061 #ifdef DEBUG |
| 3839 void MapVerify(); | 4062 void MapVerify(); |
| 3840 void SharedMapVerify(); | 4063 void SharedMapVerify(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3909 static const int kIsHiddenPrototype = 2; | 4132 static const int kIsHiddenPrototype = 2; |
| 3910 static const int kHasNamedInterceptor = 3; | 4133 static const int kHasNamedInterceptor = 3; |
| 3911 static const int kHasIndexedInterceptor = 4; | 4134 static const int kHasIndexedInterceptor = 4; |
| 3912 static const int kIsUndetectable = 5; | 4135 static const int kIsUndetectable = 5; |
| 3913 static const int kHasInstanceCallHandler = 6; | 4136 static const int kHasInstanceCallHandler = 6; |
| 3914 static const int kIsAccessCheckNeeded = 7; | 4137 static const int kIsAccessCheckNeeded = 7; |
| 3915 | 4138 |
| 3916 // Bit positions for bit field 2 | 4139 // Bit positions for bit field 2 |
| 3917 static const int kIsExtensible = 0; | 4140 static const int kIsExtensible = 0; |
| 3918 static const int kFunctionWithPrototype = 1; | 4141 static const int kFunctionWithPrototype = 1; |
| 3919 static const int kHasFastElements = 2; | 4142 static const int kStringWrapperSafeForDefaultValueOf = 2; |
| 3920 static const int kStringWrapperSafeForDefaultValueOf = 3; | 4143 static const int kAttachedToSharedFunctionInfo = 3; |
| 3921 static const int kAttachedToSharedFunctionInfo = 4; | 4144 // No bits can be used after kElementsKindFirstBit, they are all reserved for |
| 3922 static const int kHasExternalArrayElements = 5; | 4145 // storing ElementKind. for anything other than storing the ElementKind. |
| 4146 static const int kElementsKindShift = 4; |
| 4147 static const int kElementsKindBitCount = 4; |
| 4148 |
| 4149 // Derived values from bit field 2 |
| 4150 static const int kElementsKindMask = (-1 << kElementsKindShift) & |
| 4151 ((1 << (kElementsKindShift + kElementsKindBitCount)) - 1); |
| 4152 static const int8_t kMaximumBitField2FastElementValue = static_cast<int8_t>( |
| 4153 (JSObject::FAST_ELEMENTS + 1) << Map::kElementsKindShift) - 1; |
| 3923 | 4154 |
| 3924 // Bit positions for bit field 3 | 4155 // Bit positions for bit field 3 |
| 3925 static const int kIsShared = 1; | 4156 static const int kIsShared = 0; |
| 3926 | 4157 |
| 3927 // Layout of the default cache. It holds alternating name and code objects. | 4158 // Layout of the default cache. It holds alternating name and code objects. |
| 3928 static const int kCodeCacheEntrySize = 2; | 4159 static const int kCodeCacheEntrySize = 2; |
| 3929 static const int kCodeCacheEntryNameOffset = 0; | 4160 static const int kCodeCacheEntryNameOffset = 0; |
| 3930 static const int kCodeCacheEntryCodeOffset = 1; | 4161 static const int kCodeCacheEntryCodeOffset = 1; |
| 3931 | 4162 |
| 3932 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, | 4163 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, |
| 3933 kPointerFieldsEndOffset, | 4164 kPointerFieldsEndOffset, |
| 3934 kSize> BodyDescriptor; | 4165 kSize> BodyDescriptor; |
| 3935 | 4166 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4210 // is weak. IsInobjectSlackTrackingInProgress is false after this call. | 4441 // is weak. IsInobjectSlackTrackingInProgress is false after this call. |
| 4211 void DetachInitialMap(); | 4442 void DetachInitialMap(); |
| 4212 | 4443 |
| 4213 // Restores the link to the initial map after the GC marking phase. | 4444 // Restores the link to the initial map after the GC marking phase. |
| 4214 // IsInobjectSlackTrackingInProgress is true after this call. | 4445 // IsInobjectSlackTrackingInProgress is true after this call. |
| 4215 void AttachInitialMap(Map* map); | 4446 void AttachInitialMap(Map* map); |
| 4216 | 4447 |
| 4217 // False if there are definitely no live objects created from this function. | 4448 // False if there are definitely no live objects created from this function. |
| 4218 // True if live objects _may_ exist (existence not guaranteed). | 4449 // True if live objects _may_ exist (existence not guaranteed). |
| 4219 // May go back from true to false after GC. | 4450 // May go back from true to false after GC. |
| 4220 inline bool live_objects_may_exist(); | 4451 DECL_BOOLEAN_ACCESSORS(live_objects_may_exist) |
| 4221 | |
| 4222 inline void set_live_objects_may_exist(bool value); | |
| 4223 | 4452 |
| 4224 // [instance class name]: class name for instances. | 4453 // [instance class name]: class name for instances. |
| 4225 DECL_ACCESSORS(instance_class_name, Object) | 4454 DECL_ACCESSORS(instance_class_name, Object) |
| 4226 | 4455 |
| 4227 // [function data]: This field holds some additional data for function. | 4456 // [function data]: This field holds some additional data for function. |
| 4228 // Currently it either has FunctionTemplateInfo to make benefit the API | 4457 // Currently it either has FunctionTemplateInfo to make benefit the API |
| 4229 // or Smi identifying a builtin function. | 4458 // or Smi identifying a builtin function. |
| 4230 // In the long run we don't want all functions to have this field but | 4459 // In the long run we don't want all functions to have this field but |
| 4231 // we can fix that when we have a better model for storing hidden data | 4460 // we can fix that when we have a better model for storing hidden data |
| 4232 // on objects. | 4461 // on objects. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4303 // Clear information on assignments of the form this.x = ...; | 4532 // Clear information on assignments of the form this.x = ...; |
| 4304 void ClearThisPropertyAssignmentsInfo(); | 4533 void ClearThisPropertyAssignmentsInfo(); |
| 4305 | 4534 |
| 4306 // Indicate that this function only consists of assignments of the form | 4535 // Indicate that this function only consists of assignments of the form |
| 4307 // this.x = y; where y is either a constant or refers to an argument. | 4536 // this.x = y; where y is either a constant or refers to an argument. |
| 4308 inline bool has_only_simple_this_property_assignments(); | 4537 inline bool has_only_simple_this_property_assignments(); |
| 4309 | 4538 |
| 4310 // Indicates if this function can be lazy compiled. | 4539 // Indicates if this function can be lazy compiled. |
| 4311 // This is used to determine if we can safely flush code from a function | 4540 // This is used to determine if we can safely flush code from a function |
| 4312 // when doing GC if we expect that the function will no longer be used. | 4541 // when doing GC if we expect that the function will no longer be used. |
| 4313 inline bool allows_lazy_compilation(); | 4542 DECL_BOOLEAN_ACCESSORS(allows_lazy_compilation) |
| 4314 inline void set_allows_lazy_compilation(bool flag); | |
| 4315 | 4543 |
| 4316 // Indicates how many full GCs this function has survived with assigned | 4544 // Indicates how many full GCs this function has survived with assigned |
| 4317 // code object. Used to determine when it is relatively safe to flush | 4545 // code object. Used to determine when it is relatively safe to flush |
| 4318 // this code object and replace it with lazy compilation stub. | 4546 // this code object and replace it with lazy compilation stub. |
| 4319 // Age is reset when GC notices that the code object is referenced | 4547 // Age is reset when GC notices that the code object is referenced |
| 4320 // from the stack or compilation cache. | 4548 // from the stack or compilation cache. |
| 4321 inline int code_age(); | 4549 inline int code_age(); |
| 4322 inline void set_code_age(int age); | 4550 inline void set_code_age(int age); |
| 4323 | 4551 |
| 4324 // Indicates whether optimizations have been disabled for this | 4552 // Indicates whether optimizations have been disabled for this |
| 4325 // shared function info. If a function is repeatedly optimized or if | 4553 // shared function info. If a function is repeatedly optimized or if |
| 4326 // we cannot optimize the function we disable optimization to avoid | 4554 // we cannot optimize the function we disable optimization to avoid |
| 4327 // spending time attempting to optimize it again. | 4555 // spending time attempting to optimize it again. |
| 4328 inline bool optimization_disabled(); | 4556 DECL_BOOLEAN_ACCESSORS(optimization_disabled) |
| 4329 inline void set_optimization_disabled(bool value); | |
| 4330 | 4557 |
| 4331 // Indicates whether the function is a strict mode function. | 4558 // Indicates whether the function is a strict mode function. |
| 4332 inline bool strict_mode(); | 4559 DECL_BOOLEAN_ACCESSORS(strict_mode) |
| 4333 inline void set_strict_mode(bool value); | |
| 4334 | 4560 |
| 4335 // Indicates whether the function is a native ES5 function. | 4561 // False if the function definitely does not allocate an arguments object. |
| 4562 DECL_BOOLEAN_ACCESSORS(uses_arguments) |
| 4563 |
| 4564 // True if the function has any duplicated parameter names. |
| 4565 DECL_BOOLEAN_ACCESSORS(has_duplicate_parameters) |
| 4566 |
| 4567 // Indicates whether the function is a native function. |
| 4336 // These needs special threatment in .call and .apply since | 4568 // These needs special threatment in .call and .apply since |
| 4337 // null passed as the receiver should not be translated to the | 4569 // null passed as the receiver should not be translated to the |
| 4338 // global object. | 4570 // global object. |
| 4339 inline bool es5_native(); | 4571 inline bool native(); |
| 4340 inline void set_es5_native(bool value); | 4572 inline void set_native(bool value); |
| 4573 |
| 4574 // Indicates whether the function is a bound function created using |
| 4575 // the bind function. |
| 4576 inline bool bound(); |
| 4577 inline void set_bound(bool value); |
| 4341 | 4578 |
| 4342 // Indicates whether or not the code in the shared function support | 4579 // Indicates whether or not the code in the shared function support |
| 4343 // deoptimization. | 4580 // deoptimization. |
| 4344 inline bool has_deoptimization_support(); | 4581 inline bool has_deoptimization_support(); |
| 4345 | 4582 |
| 4346 // Enable deoptimization support through recompiled code. | 4583 // Enable deoptimization support through recompiled code. |
| 4347 void EnableDeoptimizationSupport(Code* recompiled); | 4584 void EnableDeoptimizationSupport(Code* recompiled); |
| 4348 | 4585 |
| 4349 // Disable (further) attempted optimization of all functions sharing this | 4586 // Disable (further) attempted optimization of all functions sharing this |
| 4350 // shared function info. The function is the one we actually tried to | 4587 // shared function info. The function is the one we actually tried to |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4510 | 4747 |
| 4511 // Bit positions in start_position_and_type. | 4748 // Bit positions in start_position_and_type. |
| 4512 // The source code start position is in the 30 most significant bits of | 4749 // The source code start position is in the 30 most significant bits of |
| 4513 // the start_position_and_type field. | 4750 // the start_position_and_type field. |
| 4514 static const int kIsExpressionBit = 0; | 4751 static const int kIsExpressionBit = 0; |
| 4515 static const int kIsTopLevelBit = 1; | 4752 static const int kIsTopLevelBit = 1; |
| 4516 static const int kStartPositionShift = 2; | 4753 static const int kStartPositionShift = 2; |
| 4517 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); | 4754 static const int kStartPositionMask = ~((1 << kStartPositionShift) - 1); |
| 4518 | 4755 |
| 4519 // Bit positions in compiler_hints. | 4756 // Bit positions in compiler_hints. |
| 4520 static const int kHasOnlySimpleThisPropertyAssignments = 0; | 4757 static const int kCodeAgeSize = 3; |
| 4521 static const int kAllowLazyCompilation = 1; | 4758 static const int kCodeAgeMask = (1 << kCodeAgeSize) - 1; |
| 4522 static const int kLiveObjectsMayExist = 2; | 4759 static const int kBoundFunction = 9; |
| 4523 static const int kCodeAgeShift = 3; | 4760 |
| 4524 static const int kCodeAgeMask = 0x7; | 4761 enum CompilerHints { |
| 4525 static const int kOptimizationDisabled = 6; | 4762 kHasOnlySimpleThisPropertyAssignments, |
| 4526 static const int kStrictModeFunction = 7; | 4763 kAllowLazyCompilation, |
| 4527 static const int kES5Native = 8; | 4764 kLiveObjectsMayExist, |
| 4765 kCodeAgeShift, |
| 4766 kOptimizationDisabled = kCodeAgeShift + kCodeAgeSize, |
| 4767 kStrictModeFunction, |
| 4768 kUsesArguments, |
| 4769 kHasDuplicateParameters, |
| 4770 kNative |
| 4771 }; |
| 4528 | 4772 |
| 4529 private: | 4773 private: |
| 4530 #if V8_HOST_ARCH_32_BIT | 4774 #if V8_HOST_ARCH_32_BIT |
| 4531 // On 32 bit platforms, compiler hints is a smi. | 4775 // On 32 bit platforms, compiler hints is a smi. |
| 4532 static const int kCompilerHintsSmiTagSize = kSmiTagSize; | 4776 static const int kCompilerHintsSmiTagSize = kSmiTagSize; |
| 4533 static const int kCompilerHintsSize = kPointerSize; | 4777 static const int kCompilerHintsSize = kPointerSize; |
| 4534 #else | 4778 #else |
| 4535 // On 64 bit platforms, compiler hints is not a smi, see comment above. | 4779 // On 64 bit platforms, compiler hints is not a smi, see comment above. |
| 4536 static const int kCompilerHintsSmiTagSize = 0; | 4780 static const int kCompilerHintsSmiTagSize = 0; |
| 4537 static const int kCompilerHintsSize = kIntSize; | 4781 static const int kCompilerHintsSize = kIntSize; |
| 4538 #endif | 4782 #endif |
| 4539 | 4783 |
| 4540 public: | 4784 public: |
| 4541 // Constants for optimizing codegen for strict mode function and | 4785 // Constants for optimizing codegen for strict mode function and |
| 4542 // es5 native tests. | 4786 // native tests. |
| 4543 // Allows to use byte-widgh instructions. | 4787 // Allows to use byte-widgh instructions. |
| 4544 static const int kStrictModeBitWithinByte = | 4788 static const int kStrictModeBitWithinByte = |
| 4545 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; | 4789 (kStrictModeFunction + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4546 | 4790 |
| 4547 static const int kES5NativeBitWithinByte = | 4791 static const int kNativeBitWithinByte = |
| 4548 (kES5Native + kCompilerHintsSmiTagSize) % kBitsPerByte; | 4792 (kNative + kCompilerHintsSmiTagSize) % kBitsPerByte; |
| 4549 | 4793 |
| 4550 #if __BYTE_ORDER == __LITTLE_ENDIAN | 4794 #if __BYTE_ORDER == __LITTLE_ENDIAN |
| 4551 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 4795 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 4552 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; | 4796 (kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 4553 static const int kES5NativeByteOffset = kCompilerHintsOffset + | 4797 static const int kNativeByteOffset = kCompilerHintsOffset + |
| 4554 (kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte; | 4798 (kNative + kCompilerHintsSmiTagSize) / kBitsPerByte; |
| 4555 #elif __BYTE_ORDER == __BIG_ENDIAN | 4799 #elif __BYTE_ORDER == __BIG_ENDIAN |
| 4556 static const int kStrictModeByteOffset = kCompilerHintsOffset + | 4800 static const int kStrictModeByteOffset = kCompilerHintsOffset + |
| 4557 (kCompilerHintsSize - 1) - | 4801 (kCompilerHintsSize - 1) - |
| 4558 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); | 4802 ((kStrictModeFunction + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 4559 static const int kES5NativeByteOffset = kCompilerHintsOffset + | 4803 static const int kNativeByteOffset = kCompilerHintsOffset + |
| 4560 (kCompilerHintsSize - 1) - | 4804 (kCompilerHintsSize - 1) - |
| 4561 ((kES5Native + kCompilerHintsSmiTagSize) / kBitsPerByte); | 4805 ((kNative + kCompilerHintsSmiTagSize) / kBitsPerByte); |
| 4562 #else | 4806 #else |
| 4563 #error Unknown byte ordering | 4807 #error Unknown byte ordering |
| 4564 #endif | 4808 #endif |
| 4565 | 4809 |
| 4566 private: | 4810 private: |
| 4567 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); | 4811 DISALLOW_IMPLICIT_CONSTRUCTORS(SharedFunctionInfo); |
| 4568 }; | 4812 }; |
| 4569 | 4813 |
| 4570 | 4814 |
| 4571 // JSFunction describes JavaScript functions. | 4815 // JSFunction describes JavaScript functions. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4608 inline bool IsOptimizable(); | 4852 inline bool IsOptimizable(); |
| 4609 | 4853 |
| 4610 // Mark this function for lazy recompilation. The function will be | 4854 // Mark this function for lazy recompilation. The function will be |
| 4611 // recompiled the next time it is executed. | 4855 // recompiled the next time it is executed. |
| 4612 void MarkForLazyRecompilation(); | 4856 void MarkForLazyRecompilation(); |
| 4613 | 4857 |
| 4614 // Tells whether or not the function is already marked for lazy | 4858 // Tells whether or not the function is already marked for lazy |
| 4615 // recompilation. | 4859 // recompilation. |
| 4616 inline bool IsMarkedForLazyRecompilation(); | 4860 inline bool IsMarkedForLazyRecompilation(); |
| 4617 | 4861 |
| 4618 // Compute a hash code for the source code of this function. | |
| 4619 uint32_t SourceHash(); | |
| 4620 | |
| 4621 // Check whether or not this function is inlineable. | 4862 // Check whether or not this function is inlineable. |
| 4622 bool IsInlineable(); | 4863 bool IsInlineable(); |
| 4623 | 4864 |
| 4624 // [literals]: Fixed array holding the materialized literals. | 4865 // [literals]: Fixed array holding the materialized literals. |
| 4625 // | 4866 // |
| 4626 // If the function contains object, regexp or array literals, the | 4867 // If the function contains object, regexp or array literals, the |
| 4627 // literals array prefix contains the object, regexp, and array | 4868 // literals array prefix contains the object, regexp, and array |
| 4628 // function to be used when creating these literals. This is | 4869 // function to be used when creating these literals. This is |
| 4629 // necessary so that we do not dynamically lookup the object, regexp | 4870 // necessary so that we do not dynamically lookup the object, regexp |
| 4630 // or array functions. Performing a dynamic lookup, we might end up | 4871 // or array functions. Performing a dynamic lookup, we might end up |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4710 kPrototypeOrInitialMapOffset + kPointerSize; | 4951 kPrototypeOrInitialMapOffset + kPointerSize; |
| 4711 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; | 4952 static const int kContextOffset = kSharedFunctionInfoOffset + kPointerSize; |
| 4712 static const int kLiteralsOffset = kContextOffset + kPointerSize; | 4953 static const int kLiteralsOffset = kContextOffset + kPointerSize; |
| 4713 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; | 4954 static const int kNonWeakFieldsEndOffset = kLiteralsOffset + kPointerSize; |
| 4714 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; | 4955 static const int kNextFunctionLinkOffset = kNonWeakFieldsEndOffset; |
| 4715 static const int kSize = kNextFunctionLinkOffset + kPointerSize; | 4956 static const int kSize = kNextFunctionLinkOffset + kPointerSize; |
| 4716 | 4957 |
| 4717 // Layout of the literals array. | 4958 // Layout of the literals array. |
| 4718 static const int kLiteralsPrefixSize = 1; | 4959 static const int kLiteralsPrefixSize = 1; |
| 4719 static const int kLiteralGlobalContextIndex = 0; | 4960 static const int kLiteralGlobalContextIndex = 0; |
| 4961 |
| 4720 private: | 4962 private: |
| 4721 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); | 4963 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunction); |
| 4722 }; | 4964 }; |
| 4723 | 4965 |
| 4724 | 4966 |
| 4725 // JSGlobalProxy's prototype must be a JSGlobalObject or null, | 4967 // JSGlobalProxy's prototype must be a JSGlobalObject or null, |
| 4726 // and the prototype is hidden. JSGlobalProxy always delegates | 4968 // and the prototype is hidden. JSGlobalProxy always delegates |
| 4727 // property accesses to its prototype if the prototype is not null. | 4969 // property accesses to its prototype if the prototype is not null. |
| 4728 // | 4970 // |
| 4729 // A JSGlobalProxy can be reinitialized which will preserve its identity. | 4971 // A JSGlobalProxy can be reinitialized which will preserve its identity. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4748 #endif | 4990 #endif |
| 4749 #ifdef DEBUG | 4991 #ifdef DEBUG |
| 4750 void JSGlobalProxyVerify(); | 4992 void JSGlobalProxyVerify(); |
| 4751 #endif | 4993 #endif |
| 4752 | 4994 |
| 4753 // Layout description. | 4995 // Layout description. |
| 4754 static const int kContextOffset = JSObject::kHeaderSize; | 4996 static const int kContextOffset = JSObject::kHeaderSize; |
| 4755 static const int kSize = kContextOffset + kPointerSize; | 4997 static const int kSize = kContextOffset + kPointerSize; |
| 4756 | 4998 |
| 4757 private: | 4999 private: |
| 4758 | |
| 4759 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); | 5000 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalProxy); |
| 4760 }; | 5001 }; |
| 4761 | 5002 |
| 4762 | 5003 |
| 4763 // Forward declaration. | 5004 // Forward declaration. |
| 4764 class JSBuiltinsObject; | 5005 class JSBuiltinsObject; |
| 4765 class JSGlobalPropertyCell; | 5006 class JSGlobalPropertyCell; |
| 4766 | 5007 |
| 4767 // Common super class for JavaScript global objects and the special | 5008 // Common super class for JavaScript global objects and the special |
| 4768 // builtins global objects. | 5009 // builtins global objects. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4804 private: | 5045 private: |
| 4805 friend class AGCCVersionRequiresThisClassToHaveAFriendSoHereItIs; | 5046 friend class AGCCVersionRequiresThisClassToHaveAFriendSoHereItIs; |
| 4806 | 5047 |
| 4807 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); | 5048 DISALLOW_IMPLICIT_CONSTRUCTORS(GlobalObject); |
| 4808 }; | 5049 }; |
| 4809 | 5050 |
| 4810 | 5051 |
| 4811 // JavaScript global object. | 5052 // JavaScript global object. |
| 4812 class JSGlobalObject: public GlobalObject { | 5053 class JSGlobalObject: public GlobalObject { |
| 4813 public: | 5054 public: |
| 4814 | |
| 4815 // Casting. | 5055 // Casting. |
| 4816 static inline JSGlobalObject* cast(Object* obj); | 5056 static inline JSGlobalObject* cast(Object* obj); |
| 4817 | 5057 |
| 4818 // Dispatched behavior. | 5058 // Dispatched behavior. |
| 4819 #ifdef OBJECT_PRINT | 5059 #ifdef OBJECT_PRINT |
| 4820 inline void JSGlobalObjectPrint() { | 5060 inline void JSGlobalObjectPrint() { |
| 4821 JSGlobalObjectPrint(stdout); | 5061 JSGlobalObjectPrint(stdout); |
| 4822 } | 5062 } |
| 4823 void JSGlobalObjectPrint(FILE* out); | 5063 void JSGlobalObjectPrint(FILE* out); |
| 4824 #endif | 5064 #endif |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4976 // Regular expressions | 5216 // Regular expressions |
| 4977 // The regular expression holds a single reference to a FixedArray in | 5217 // The regular expression holds a single reference to a FixedArray in |
| 4978 // the kDataOffset field. | 5218 // the kDataOffset field. |
| 4979 // The FixedArray contains the following data: | 5219 // The FixedArray contains the following data: |
| 4980 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) | 5220 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) |
| 4981 // - reference to the original source string | 5221 // - reference to the original source string |
| 4982 // - reference to the original flag string | 5222 // - reference to the original flag string |
| 4983 // If it is an atom regexp | 5223 // If it is an atom regexp |
| 4984 // - a reference to a literal string to search for | 5224 // - a reference to a literal string to search for |
| 4985 // If it is an irregexp regexp: | 5225 // If it is an irregexp regexp: |
| 4986 // - a reference to code for ASCII inputs (bytecode or compiled). | 5226 // - a reference to code for ASCII inputs (bytecode or compiled), or a smi |
| 4987 // - a reference to code for UC16 inputs (bytecode or compiled). | 5227 // used for tracking the last usage (used for code flushing). |
| 5228 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi |
| 5229 // used for tracking the last usage (used for code flushing).. |
| 4988 // - max number of registers used by irregexp implementations. | 5230 // - max number of registers used by irregexp implementations. |
| 4989 // - number of capture registers (output values) of the regexp. | 5231 // - number of capture registers (output values) of the regexp. |
| 4990 class JSRegExp: public JSObject { | 5232 class JSRegExp: public JSObject { |
| 4991 public: | 5233 public: |
| 4992 // Meaning of Type: | 5234 // Meaning of Type: |
| 4993 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. | 5235 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. |
| 4994 // ATOM: A simple string to match against using an indexOf operation. | 5236 // ATOM: A simple string to match against using an indexOf operation. |
| 4995 // IRREGEXP: Compiled with Irregexp. | 5237 // IRREGEXP: Compiled with Irregexp. |
| 4996 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. | 5238 // IRREGEXP_NATIVE: Compiled to native code with Irregexp. |
| 4997 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; | 5239 enum Type { NOT_COMPILED, ATOM, IRREGEXP }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 5010 | 5252 |
| 5011 DECL_ACCESSORS(data, Object) | 5253 DECL_ACCESSORS(data, Object) |
| 5012 | 5254 |
| 5013 inline Type TypeTag(); | 5255 inline Type TypeTag(); |
| 5014 inline int CaptureCount(); | 5256 inline int CaptureCount(); |
| 5015 inline Flags GetFlags(); | 5257 inline Flags GetFlags(); |
| 5016 inline String* Pattern(); | 5258 inline String* Pattern(); |
| 5017 inline Object* DataAt(int index); | 5259 inline Object* DataAt(int index); |
| 5018 // Set implementation data after the object has been prepared. | 5260 // Set implementation data after the object has been prepared. |
| 5019 inline void SetDataAt(int index, Object* value); | 5261 inline void SetDataAt(int index, Object* value); |
| 5262 |
| 5263 // Used during GC when flushing code or setting age. |
| 5264 inline Object* DataAtUnchecked(int index); |
| 5265 inline void SetDataAtUnchecked(int index, Object* value, Heap* heap); |
| 5266 inline Type TypeTagUnchecked(); |
| 5267 |
| 5020 static int code_index(bool is_ascii) { | 5268 static int code_index(bool is_ascii) { |
| 5021 if (is_ascii) { | 5269 if (is_ascii) { |
| 5022 return kIrregexpASCIICodeIndex; | 5270 return kIrregexpASCIICodeIndex; |
| 5023 } else { | 5271 } else { |
| 5024 return kIrregexpUC16CodeIndex; | 5272 return kIrregexpUC16CodeIndex; |
| 5025 } | 5273 } |
| 5026 } | 5274 } |
| 5027 | 5275 |
| 5276 static int saved_code_index(bool is_ascii) { |
| 5277 if (is_ascii) { |
| 5278 return kIrregexpASCIICodeSavedIndex; |
| 5279 } else { |
| 5280 return kIrregexpUC16CodeSavedIndex; |
| 5281 } |
| 5282 } |
| 5283 |
| 5028 static inline JSRegExp* cast(Object* obj); | 5284 static inline JSRegExp* cast(Object* obj); |
| 5029 | 5285 |
| 5030 // Dispatched behavior. | 5286 // Dispatched behavior. |
| 5031 #ifdef DEBUG | 5287 #ifdef DEBUG |
| 5032 void JSRegExpVerify(); | 5288 void JSRegExpVerify(); |
| 5033 #endif | 5289 #endif |
| 5034 | 5290 |
| 5035 static const int kDataOffset = JSObject::kHeaderSize; | 5291 static const int kDataOffset = JSObject::kHeaderSize; |
| 5036 static const int kSize = kDataOffset + kPointerSize; | 5292 static const int kSize = kDataOffset + kPointerSize; |
| 5037 | 5293 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5048 static const int kAtomDataSize = kAtomPatternIndex + 1; | 5304 static const int kAtomDataSize = kAtomPatternIndex + 1; |
| 5049 | 5305 |
| 5050 // Irregexp compiled code or bytecode for ASCII. If compilation | 5306 // Irregexp compiled code or bytecode for ASCII. If compilation |
| 5051 // fails, this fields hold an exception object that should be | 5307 // fails, this fields hold an exception object that should be |
| 5052 // thrown if the regexp is used again. | 5308 // thrown if the regexp is used again. |
| 5053 static const int kIrregexpASCIICodeIndex = kDataIndex; | 5309 static const int kIrregexpASCIICodeIndex = kDataIndex; |
| 5054 // Irregexp compiled code or bytecode for UC16. If compilation | 5310 // Irregexp compiled code or bytecode for UC16. If compilation |
| 5055 // fails, this fields hold an exception object that should be | 5311 // fails, this fields hold an exception object that should be |
| 5056 // thrown if the regexp is used again. | 5312 // thrown if the regexp is used again. |
| 5057 static const int kIrregexpUC16CodeIndex = kDataIndex + 1; | 5313 static const int kIrregexpUC16CodeIndex = kDataIndex + 1; |
| 5314 |
| 5315 // Saved instance of Irregexp compiled code or bytecode for ASCII that |
| 5316 // is a potential candidate for flushing. |
| 5317 static const int kIrregexpASCIICodeSavedIndex = kDataIndex + 2; |
| 5318 // Saved instance of Irregexp compiled code or bytecode for UC16 that is |
| 5319 // a potential candidate for flushing. |
| 5320 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; |
| 5321 |
| 5058 // Maximal number of registers used by either ASCII or UC16. | 5322 // Maximal number of registers used by either ASCII or UC16. |
| 5059 // Only used to check that there is enough stack space | 5323 // Only used to check that there is enough stack space |
| 5060 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 2; | 5324 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; |
| 5061 // Number of captures in the compiled regexp. | 5325 // Number of captures in the compiled regexp. |
| 5062 static const int kIrregexpCaptureCountIndex = kDataIndex + 3; | 5326 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; |
| 5063 | 5327 |
| 5064 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; | 5328 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; |
| 5065 | 5329 |
| 5066 // Offsets directly into the data fixed array. | 5330 // Offsets directly into the data fixed array. |
| 5067 static const int kDataTagOffset = | 5331 static const int kDataTagOffset = |
| 5068 FixedArray::kHeaderSize + kTagIndex * kPointerSize; | 5332 FixedArray::kHeaderSize + kTagIndex * kPointerSize; |
| 5069 static const int kDataAsciiCodeOffset = | 5333 static const int kDataAsciiCodeOffset = |
| 5070 FixedArray::kHeaderSize + kIrregexpASCIICodeIndex * kPointerSize; | 5334 FixedArray::kHeaderSize + kIrregexpASCIICodeIndex * kPointerSize; |
| 5071 static const int kDataUC16CodeOffset = | 5335 static const int kDataUC16CodeOffset = |
| 5072 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; | 5336 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; |
| 5073 static const int kIrregexpCaptureCountOffset = | 5337 static const int kIrregexpCaptureCountOffset = |
| 5074 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; | 5338 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; |
| 5075 | 5339 |
| 5076 // In-object fields. | 5340 // In-object fields. |
| 5077 static const int kSourceFieldIndex = 0; | 5341 static const int kSourceFieldIndex = 0; |
| 5078 static const int kGlobalFieldIndex = 1; | 5342 static const int kGlobalFieldIndex = 1; |
| 5079 static const int kIgnoreCaseFieldIndex = 2; | 5343 static const int kIgnoreCaseFieldIndex = 2; |
| 5080 static const int kMultilineFieldIndex = 3; | 5344 static const int kMultilineFieldIndex = 3; |
| 5081 static const int kLastIndexFieldIndex = 4; | 5345 static const int kLastIndexFieldIndex = 4; |
| 5082 static const int kInObjectFieldCount = 5; | 5346 static const int kInObjectFieldCount = 5; |
| 5347 |
| 5348 // The uninitialized value for a regexp code object. |
| 5349 static const int kUninitializedValue = -1; |
| 5350 |
| 5351 // The compilation error value for the regexp code object. The real error |
| 5352 // object is in the saved code field. |
| 5353 static const int kCompilationErrorValue = -2; |
| 5354 |
| 5355 // When we store the sweep generation at which we moved the code from the |
| 5356 // code index to the saved code index we mask it of to be in the [0:255] |
| 5357 // range. |
| 5358 static const int kCodeAgeMask = 0xff; |
| 5083 }; | 5359 }; |
| 5084 | 5360 |
| 5085 | 5361 |
| 5086 class CompilationCacheShape { | 5362 class CompilationCacheShape { |
| 5087 public: | 5363 public: |
| 5088 static inline bool IsMatch(HashTableKey* key, Object* value) { | 5364 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 5089 return key->IsMatch(value); | 5365 return key->IsMatch(value); |
| 5090 } | 5366 } |
| 5091 | 5367 |
| 5092 static inline uint32_t Hash(HashTableKey* key) { | 5368 static inline uint32_t Hash(HashTableKey* key) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5218 static inline CodeCacheHashTable* cast(Object* obj); | 5494 static inline CodeCacheHashTable* cast(Object* obj); |
| 5219 | 5495 |
| 5220 // Initial size of the fixed array backing the hash table. | 5496 // Initial size of the fixed array backing the hash table. |
| 5221 static const int kInitialSize = 64; | 5497 static const int kInitialSize = 64; |
| 5222 | 5498 |
| 5223 private: | 5499 private: |
| 5224 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); | 5500 DISALLOW_IMPLICIT_CONSTRUCTORS(CodeCacheHashTable); |
| 5225 }; | 5501 }; |
| 5226 | 5502 |
| 5227 | 5503 |
| 5504 class PolymorphicCodeCache: public Struct { |
| 5505 public: |
| 5506 DECL_ACCESSORS(cache, Object) |
| 5507 |
| 5508 MUST_USE_RESULT MaybeObject* Update(MapList* maps, |
| 5509 Code::Flags flags, |
| 5510 Code* code); |
| 5511 Object* Lookup(MapList* maps, Code::Flags flags); |
| 5512 |
| 5513 static inline PolymorphicCodeCache* cast(Object* obj); |
| 5514 |
| 5515 #ifdef OBJECT_PRINT |
| 5516 inline void PolymorphicCodeCachePrint() { |
| 5517 PolymorphicCodeCachePrint(stdout); |
| 5518 } |
| 5519 void PolymorphicCodeCachePrint(FILE* out); |
| 5520 #endif |
| 5521 #ifdef DEBUG |
| 5522 void PolymorphicCodeCacheVerify(); |
| 5523 #endif |
| 5524 |
| 5525 static const int kCacheOffset = HeapObject::kHeaderSize; |
| 5526 static const int kSize = kCacheOffset + kPointerSize; |
| 5527 |
| 5528 private: |
| 5529 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCache); |
| 5530 }; |
| 5531 |
| 5532 |
| 5533 class PolymorphicCodeCacheHashTable |
| 5534 : public HashTable<CodeCacheHashTableShape, HashTableKey*> { |
| 5535 public: |
| 5536 Object* Lookup(MapList* maps, int code_kind); |
| 5537 MUST_USE_RESULT MaybeObject* Put(MapList* maps, int code_kind, Code* code); |
| 5538 |
| 5539 static inline PolymorphicCodeCacheHashTable* cast(Object* obj); |
| 5540 |
| 5541 static const int kInitialSize = 64; |
| 5542 private: |
| 5543 DISALLOW_IMPLICIT_CONSTRUCTORS(PolymorphicCodeCacheHashTable); |
| 5544 }; |
| 5545 |
| 5546 |
| 5228 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; | 5547 enum AllowNullsFlag {ALLOW_NULLS, DISALLOW_NULLS}; |
| 5229 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; | 5548 enum RobustnessFlag {ROBUST_STRING_TRAVERSAL, FAST_STRING_TRAVERSAL}; |
| 5230 | 5549 |
| 5231 | 5550 |
| 5232 class StringHasher { | 5551 class StringHasher { |
| 5233 public: | 5552 public: |
| 5234 explicit inline StringHasher(int length); | 5553 explicit inline StringHasher(int length); |
| 5235 | 5554 |
| 5236 // Returns true if the hash of this string can be computed without | 5555 // Returns true if the hash of this string can be computed without |
| 5237 // looking at the contents. | 5556 // looking at the contents. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5256 bool is_valid() { return is_valid_; } | 5575 bool is_valid() { return is_valid_; } |
| 5257 | 5576 |
| 5258 void invalidate() { is_valid_ = false; } | 5577 void invalidate() { is_valid_ = false; } |
| 5259 | 5578 |
| 5260 // Calculated hash value for a string consisting of 1 to | 5579 // Calculated hash value for a string consisting of 1 to |
| 5261 // String::kMaxArrayIndexSize digits with no leading zeros (except "0"). | 5580 // String::kMaxArrayIndexSize digits with no leading zeros (except "0"). |
| 5262 // value is represented decimal value. | 5581 // value is represented decimal value. |
| 5263 static uint32_t MakeArrayIndexHash(uint32_t value, int length); | 5582 static uint32_t MakeArrayIndexHash(uint32_t value, int length); |
| 5264 | 5583 |
| 5265 private: | 5584 private: |
| 5266 | |
| 5267 uint32_t array_index() { | 5585 uint32_t array_index() { |
| 5268 ASSERT(is_array_index()); | 5586 ASSERT(is_array_index()); |
| 5269 return array_index_; | 5587 return array_index_; |
| 5270 } | 5588 } |
| 5271 | 5589 |
| 5272 inline uint32_t GetHash(); | 5590 inline uint32_t GetHash(); |
| 5273 | 5591 |
| 5274 int length_; | 5592 int length_; |
| 5275 uint32_t raw_running_hash_; | 5593 uint32_t raw_running_hash_; |
| 5276 uint32_t array_index_; | 5594 uint32_t array_index_; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5313 inline StringRepresentationTag representation_tag(); | 5631 inline StringRepresentationTag representation_tag(); |
| 5314 inline uint32_t full_representation_tag(); | 5632 inline uint32_t full_representation_tag(); |
| 5315 inline uint32_t size_tag(); | 5633 inline uint32_t size_tag(); |
| 5316 #ifdef DEBUG | 5634 #ifdef DEBUG |
| 5317 inline uint32_t type() { return type_; } | 5635 inline uint32_t type() { return type_; } |
| 5318 inline void invalidate() { valid_ = false; } | 5636 inline void invalidate() { valid_ = false; } |
| 5319 inline bool valid() { return valid_; } | 5637 inline bool valid() { return valid_; } |
| 5320 #else | 5638 #else |
| 5321 inline void invalidate() { } | 5639 inline void invalidate() { } |
| 5322 #endif | 5640 #endif |
| 5641 |
| 5323 private: | 5642 private: |
| 5324 uint32_t type_; | 5643 uint32_t type_; |
| 5325 #ifdef DEBUG | 5644 #ifdef DEBUG |
| 5326 inline void set_valid() { valid_ = true; } | 5645 inline void set_valid() { valid_ = true; } |
| 5327 bool valid_; | 5646 bool valid_; |
| 5328 #else | 5647 #else |
| 5329 inline void set_valid() { } | 5648 inline void set_valid() { } |
| 5330 #endif | 5649 #endif |
| 5331 }; | 5650 }; |
| 5332 | 5651 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5650 // Compute and set the hash code. | 5969 // Compute and set the hash code. |
| 5651 uint32_t ComputeAndSetHash(); | 5970 uint32_t ComputeAndSetHash(); |
| 5652 | 5971 |
| 5653 DISALLOW_IMPLICIT_CONSTRUCTORS(String); | 5972 DISALLOW_IMPLICIT_CONSTRUCTORS(String); |
| 5654 }; | 5973 }; |
| 5655 | 5974 |
| 5656 | 5975 |
| 5657 // The SeqString abstract class captures sequential string values. | 5976 // The SeqString abstract class captures sequential string values. |
| 5658 class SeqString: public String { | 5977 class SeqString: public String { |
| 5659 public: | 5978 public: |
| 5660 | |
| 5661 // Casting. | 5979 // Casting. |
| 5662 static inline SeqString* cast(Object* obj); | 5980 static inline SeqString* cast(Object* obj); |
| 5663 | 5981 |
| 5664 private: | 5982 private: |
| 5665 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); | 5983 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); |
| 5666 }; | 5984 }; |
| 5667 | 5985 |
| 5668 | 5986 |
| 5669 // The AsciiString class captures sequential ascii string objects. | 5987 // The AsciiString class captures sequential ascii string objects. |
| 5670 // Each character in the AsciiString is an ascii character. | 5988 // Each character in the AsciiString is an ascii character. |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6081 typedef FixedBodyDescriptor<kValueOffset, | 6399 typedef FixedBodyDescriptor<kValueOffset, |
| 6082 kValueOffset + kPointerSize, | 6400 kValueOffset + kPointerSize, |
| 6083 kSize> BodyDescriptor; | 6401 kSize> BodyDescriptor; |
| 6084 | 6402 |
| 6085 private: | 6403 private: |
| 6086 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); | 6404 DISALLOW_IMPLICIT_CONSTRUCTORS(JSGlobalPropertyCell); |
| 6087 }; | 6405 }; |
| 6088 | 6406 |
| 6089 | 6407 |
| 6090 // The JSProxy describes EcmaScript Harmony proxies | 6408 // The JSProxy describes EcmaScript Harmony proxies |
| 6091 class JSProxy: public HeapObject { | 6409 class JSProxy: public JSReceiver { |
| 6092 public: | 6410 public: |
| 6093 // [handler]: The handler property. | 6411 // [handler]: The handler property. |
| 6094 DECL_ACCESSORS(handler, Object) | 6412 DECL_ACCESSORS(handler, Object) |
| 6095 | 6413 |
| 6096 // Casting. | 6414 // Casting. |
| 6097 static inline JSProxy* cast(Object* obj); | 6415 static inline JSProxy* cast(Object* obj); |
| 6098 | 6416 |
| 6417 MUST_USE_RESULT MaybeObject* SetPropertyWithHandler( |
| 6418 String* name_raw, |
| 6419 Object* value_raw, |
| 6420 PropertyAttributes attributes, |
| 6421 StrictModeFlag strict_mode); |
| 6422 |
| 6423 MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler( |
| 6424 JSReceiver* receiver, |
| 6425 String* name_raw, |
| 6426 bool* has_exception); |
| 6427 |
| 6099 // Dispatched behavior. | 6428 // Dispatched behavior. |
| 6100 #ifdef OBJECT_PRINT | 6429 #ifdef OBJECT_PRINT |
| 6101 inline void JSProxyPrint() { | 6430 inline void JSProxyPrint() { |
| 6102 JSProxyPrint(stdout); | 6431 JSProxyPrint(stdout); |
| 6103 } | 6432 } |
| 6104 void JSProxyPrint(FILE* out); | 6433 void JSProxyPrint(FILE* out); |
| 6105 #endif | 6434 #endif |
| 6106 #ifdef DEBUG | 6435 #ifdef DEBUG |
| 6107 void JSProxyVerify(); | 6436 void JSProxyVerify(); |
| 6108 #endif | 6437 #endif |
| 6109 | 6438 |
| 6110 // Layout description. | 6439 // Layout description. |
| 6111 static const int kHandlerOffset = HeapObject::kHeaderSize; | 6440 static const int kHandlerOffset = HeapObject::kHeaderSize; |
| 6112 static const int kSize = kHandlerOffset + kPointerSize; | 6441 static const int kSize = kHandlerOffset + kPointerSize; |
| 6113 | 6442 |
| 6114 typedef FixedBodyDescriptor<kHandlerOffset, | 6443 typedef FixedBodyDescriptor<kHandlerOffset, |
| 6115 kHandlerOffset + kPointerSize, | 6444 kHandlerOffset + kPointerSize, |
| 6116 kSize> BodyDescriptor; | 6445 kSize> BodyDescriptor; |
| 6117 | 6446 |
| 6118 private: | 6447 private: |
| 6119 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); | 6448 DISALLOW_IMPLICIT_CONSTRUCTORS(JSProxy); |
| 6120 }; | 6449 }; |
| 6121 | 6450 |
| 6122 | 6451 |
| 6452 // TODO(rossberg): Only a stub for now. |
| 6453 class JSFunctionProxy: public JSProxy { |
| 6454 public: |
| 6455 // Casting. |
| 6456 static inline JSFunctionProxy* cast(Object* obj); |
| 6457 |
| 6458 private: |
| 6459 DISALLOW_IMPLICIT_CONSTRUCTORS(JSFunctionProxy); |
| 6460 }; |
| 6461 |
| 6123 | 6462 |
| 6124 // Foreign describes objects pointing from JavaScript to C structures. | 6463 // Foreign describes objects pointing from JavaScript to C structures. |
| 6125 // Since they cannot contain references to JS HeapObjects they can be | 6464 // Since they cannot contain references to JS HeapObjects they can be |
| 6126 // placed in old_data_space. | 6465 // placed in old_data_space. |
| 6127 class Foreign: public HeapObject { | 6466 class Foreign: public HeapObject { |
| 6128 public: | 6467 public: |
| 6129 // [address]: field containing the address. | 6468 // [address]: field containing the address. |
| 6130 inline Address address(); | 6469 inline Address address(); |
| 6131 inline void set_address(Address value); | 6470 inline void set_address(Address value); |
| 6132 | 6471 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6413 DECL_ACCESSORS(prototype_template, Object) | 6752 DECL_ACCESSORS(prototype_template, Object) |
| 6414 DECL_ACCESSORS(parent_template, Object) | 6753 DECL_ACCESSORS(parent_template, Object) |
| 6415 DECL_ACCESSORS(named_property_handler, Object) | 6754 DECL_ACCESSORS(named_property_handler, Object) |
| 6416 DECL_ACCESSORS(indexed_property_handler, Object) | 6755 DECL_ACCESSORS(indexed_property_handler, Object) |
| 6417 DECL_ACCESSORS(instance_template, Object) | 6756 DECL_ACCESSORS(instance_template, Object) |
| 6418 DECL_ACCESSORS(class_name, Object) | 6757 DECL_ACCESSORS(class_name, Object) |
| 6419 DECL_ACCESSORS(signature, Object) | 6758 DECL_ACCESSORS(signature, Object) |
| 6420 DECL_ACCESSORS(instance_call_handler, Object) | 6759 DECL_ACCESSORS(instance_call_handler, Object) |
| 6421 DECL_ACCESSORS(access_check_info, Object) | 6760 DECL_ACCESSORS(access_check_info, Object) |
| 6422 DECL_ACCESSORS(flag, Smi) | 6761 DECL_ACCESSORS(flag, Smi) |
| 6762 DECL_ACCESSORS(prototype_attributes, Smi) |
| 6423 | 6763 |
| 6424 // Following properties use flag bits. | 6764 // Following properties use flag bits. |
| 6425 DECL_BOOLEAN_ACCESSORS(hidden_prototype) | 6765 DECL_BOOLEAN_ACCESSORS(hidden_prototype) |
| 6426 DECL_BOOLEAN_ACCESSORS(undetectable) | 6766 DECL_BOOLEAN_ACCESSORS(undetectable) |
| 6427 // If the bit is set, object instances created by this function | 6767 // If the bit is set, object instances created by this function |
| 6428 // requires access check. | 6768 // requires access check. |
| 6429 DECL_BOOLEAN_ACCESSORS(needs_access_check) | 6769 DECL_BOOLEAN_ACCESSORS(needs_access_check) |
| 6430 | 6770 |
| 6431 static inline FunctionTemplateInfo* cast(Object* obj); | 6771 static inline FunctionTemplateInfo* cast(Object* obj); |
| 6432 | 6772 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 6452 static const int kIndexedPropertyHandlerOffset = | 6792 static const int kIndexedPropertyHandlerOffset = |
| 6453 kNamedPropertyHandlerOffset + kPointerSize; | 6793 kNamedPropertyHandlerOffset + kPointerSize; |
| 6454 static const int kInstanceTemplateOffset = | 6794 static const int kInstanceTemplateOffset = |
| 6455 kIndexedPropertyHandlerOffset + kPointerSize; | 6795 kIndexedPropertyHandlerOffset + kPointerSize; |
| 6456 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize; | 6796 static const int kClassNameOffset = kInstanceTemplateOffset + kPointerSize; |
| 6457 static const int kSignatureOffset = kClassNameOffset + kPointerSize; | 6797 static const int kSignatureOffset = kClassNameOffset + kPointerSize; |
| 6458 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize; | 6798 static const int kInstanceCallHandlerOffset = kSignatureOffset + kPointerSize; |
| 6459 static const int kAccessCheckInfoOffset = | 6799 static const int kAccessCheckInfoOffset = |
| 6460 kInstanceCallHandlerOffset + kPointerSize; | 6800 kInstanceCallHandlerOffset + kPointerSize; |
| 6461 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; | 6801 static const int kFlagOffset = kAccessCheckInfoOffset + kPointerSize; |
| 6462 static const int kSize = kFlagOffset + kPointerSize; | 6802 static const int kPrototypeAttributesOffset = kFlagOffset + kPointerSize; |
| 6803 static const int kSize = kPrototypeAttributesOffset + kPointerSize; |
| 6463 | 6804 |
| 6464 private: | 6805 private: |
| 6465 // Bit position in the flag, from least significant bit position. | 6806 // Bit position in the flag, from least significant bit position. |
| 6466 static const int kHiddenPrototypeBit = 0; | 6807 static const int kHiddenPrototypeBit = 0; |
| 6467 static const int kUndetectableBit = 1; | 6808 static const int kUndetectableBit = 1; |
| 6468 static const int kNeedsAccessCheckBit = 2; | 6809 static const int kNeedsAccessCheckBit = 2; |
| 6469 | 6810 |
| 6470 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); | 6811 DISALLOW_IMPLICIT_CONSTRUCTORS(FunctionTemplateInfo); |
| 6471 }; | 6812 }; |
| 6472 | 6813 |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6755 } else { | 7096 } else { |
| 6756 value &= ~(1 << bit_position); | 7097 value &= ~(1 << bit_position); |
| 6757 } | 7098 } |
| 6758 return value; | 7099 return value; |
| 6759 } | 7100 } |
| 6760 }; | 7101 }; |
| 6761 | 7102 |
| 6762 } } // namespace v8::internal | 7103 } } // namespace v8::internal |
| 6763 | 7104 |
| 6764 #endif // V8_OBJECTS_H_ | 7105 #endif // V8_OBJECTS_H_ |
| OLD | NEW |