| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // - JSDate | 70 // - JSDate |
| 71 // - JSMessageObject | 71 // - JSMessageObject |
| 72 // - JSProxy | 72 // - JSProxy |
| 73 // - JSFunctionProxy | 73 // - JSFunctionProxy |
| 74 // - FixedArrayBase | 74 // - FixedArrayBase |
| 75 // - ByteArray | 75 // - ByteArray |
| 76 // - FixedArray | 76 // - FixedArray |
| 77 // - DescriptorArray | 77 // - DescriptorArray |
| 78 // - HashTable | 78 // - HashTable |
| 79 // - Dictionary | 79 // - Dictionary |
| 80 // - SymbolTable | 80 // - StringTable |
| 81 // - CompilationCacheTable | 81 // - CompilationCacheTable |
| 82 // - CodeCacheHashTable | 82 // - CodeCacheHashTable |
| 83 // - MapCache | 83 // - MapCache |
| 84 // - Context | 84 // - Context |
| 85 // - JSFunctionResultCache | 85 // - JSFunctionResultCache |
| 86 // - ScopeInfo | 86 // - ScopeInfo |
| 87 // - TransitionArray | 87 // - TransitionArray |
| 88 // - FixedDoubleArray | 88 // - FixedDoubleArray |
| 89 // - ExternalArray | 89 // - ExternalArray |
| 90 // - ExternalPixelArray | 90 // - ExternalPixelArray |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 // | 224 // |
| 225 // As an example, a JavaScript object is a heap object and its map | 225 // As an example, a JavaScript object is a heap object and its map |
| 226 // instance_type is JS_OBJECT_TYPE. | 226 // instance_type is JS_OBJECT_TYPE. |
| 227 // | 227 // |
| 228 // The names of the string instance types are intended to systematically | 228 // The names of the string instance types are intended to systematically |
| 229 // mirror their encoding in the instance_type field of the map. The default | 229 // mirror their encoding in the instance_type field of the map. The default |
| 230 // encoding is considered TWO_BYTE. It is not mentioned in the name. ASCII | 230 // encoding is considered TWO_BYTE. It is not mentioned in the name. ASCII |
| 231 // encoding is mentioned explicitly in the name. Likewise, the default | 231 // encoding is mentioned explicitly in the name. Likewise, the default |
| 232 // representation is considered sequential. It is not mentioned in the | 232 // representation is considered sequential. It is not mentioned in the |
| 233 // name. The other representations (e.g. CONS, EXTERNAL) are explicitly | 233 // name. The other representations (e.g. CONS, EXTERNAL) are explicitly |
| 234 // mentioned. Finally, the string is either a SYMBOL_TYPE (if it is a | 234 // mentioned. Finally, the string is either a STRING_TYPE (if it is a normal |
| 235 // symbol) or a STRING_TYPE (if it is not a symbol). | 235 // string) or a INTERNALIZED_STRING_TYPE (if it is a internalized string). |
| 236 // | 236 // |
| 237 // NOTE: The following things are some that depend on the string types having | 237 // NOTE: The following things are some that depend on the string types having |
| 238 // instance_types that are less than those of all other types: | 238 // instance_types that are less than those of all other types: |
| 239 // HeapObject::Size, HeapObject::IterateBody, the typeof operator, and | 239 // HeapObject::Size, HeapObject::IterateBody, the typeof operator, and |
| 240 // Object::IsString. | 240 // Object::IsString. |
| 241 // | 241 // |
| 242 // NOTE: Everything following JS_VALUE_TYPE is considered a | 242 // NOTE: Everything following JS_VALUE_TYPE is considered a |
| 243 // JSObject for GC purposes. The first four entries here have typeof | 243 // JSObject for GC purposes. The first four entries here have typeof |
| 244 // 'object', whereas JS_FUNCTION_TYPE has typeof 'function'. | 244 // 'object', whereas JS_FUNCTION_TYPE has typeof 'function'. |
| 245 #define INSTANCE_TYPE_LIST_ALL(V) \ | 245 #define INSTANCE_TYPE_LIST_ALL(V) \ |
| 246 V(SYMBOL_TYPE) \ | |
| 247 V(ASCII_SYMBOL_TYPE) \ | |
| 248 V(CONS_SYMBOL_TYPE) \ | |
| 249 V(CONS_ASCII_SYMBOL_TYPE) \ | |
| 250 V(EXTERNAL_SYMBOL_TYPE) \ | |
| 251 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE) \ | |
| 252 V(EXTERNAL_ASCII_SYMBOL_TYPE) \ | |
| 253 V(SHORT_EXTERNAL_SYMBOL_TYPE) \ | |
| 254 V(SHORT_EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE) \ | |
| 255 V(SHORT_EXTERNAL_ASCII_SYMBOL_TYPE) \ | |
| 256 V(STRING_TYPE) \ | 246 V(STRING_TYPE) \ |
| 257 V(ASCII_STRING_TYPE) \ | 247 V(ASCII_STRING_TYPE) \ |
| 258 V(CONS_STRING_TYPE) \ | 248 V(CONS_STRING_TYPE) \ |
| 259 V(CONS_ASCII_STRING_TYPE) \ | 249 V(CONS_ASCII_STRING_TYPE) \ |
| 260 V(SLICED_STRING_TYPE) \ | 250 V(SLICED_STRING_TYPE) \ |
| 261 V(EXTERNAL_STRING_TYPE) \ | 251 V(EXTERNAL_STRING_TYPE) \ |
| 252 V(EXTERNAL_ASCII_STRING_TYPE) \ |
| 262 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ | 253 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ |
| 263 V(EXTERNAL_ASCII_STRING_TYPE) \ | |
| 264 V(SHORT_EXTERNAL_STRING_TYPE) \ | 254 V(SHORT_EXTERNAL_STRING_TYPE) \ |
| 255 V(SHORT_EXTERNAL_ASCII_STRING_TYPE) \ |
| 265 V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ | 256 V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \ |
| 266 V(SHORT_EXTERNAL_ASCII_STRING_TYPE) \ | 257 \ |
| 267 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ | 258 V(INTERNALIZED_STRING_TYPE) \ |
| 259 V(ASCII_INTERNALIZED_STRING_TYPE) \ |
| 260 V(CONS_INTERNALIZED_STRING_TYPE) \ |
| 261 V(CONS_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 262 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 263 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 264 V(EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE) \ |
| 265 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 266 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ |
| 267 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE) \ |
| 268 \ | 268 \ |
| 269 V(MAP_TYPE) \ | 269 V(MAP_TYPE) \ |
| 270 V(CODE_TYPE) \ | 270 V(CODE_TYPE) \ |
| 271 V(ODDBALL_TYPE) \ | 271 V(ODDBALL_TYPE) \ |
| 272 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ | 272 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ |
| 273 \ | 273 \ |
| 274 V(HEAP_NUMBER_TYPE) \ | 274 V(HEAP_NUMBER_TYPE) \ |
| 275 V(FOREIGN_TYPE) \ | 275 V(FOREIGN_TYPE) \ |
| 276 V(BYTE_ARRAY_TYPE) \ | 276 V(BYTE_ARRAY_TYPE) \ |
| 277 V(FREE_SPACE_TYPE) \ | 277 V(FREE_SPACE_TYPE) \ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 #endif | 335 #endif |
| 336 | 336 |
| 337 #define INSTANCE_TYPE_LIST(V) \ | 337 #define INSTANCE_TYPE_LIST(V) \ |
| 338 INSTANCE_TYPE_LIST_ALL(V) \ | 338 INSTANCE_TYPE_LIST_ALL(V) \ |
| 339 INSTANCE_TYPE_LIST_DEBUGGER(V) | 339 INSTANCE_TYPE_LIST_DEBUGGER(V) |
| 340 | 340 |
| 341 | 341 |
| 342 // Since string types are not consecutive, this macro is used to | 342 // Since string types are not consecutive, this macro is used to |
| 343 // iterate over them. | 343 // iterate over them. |
| 344 #define STRING_TYPE_LIST(V) \ | 344 #define STRING_TYPE_LIST(V) \ |
| 345 V(SYMBOL_TYPE, \ | |
| 346 kVariableSizeSentinel, \ | |
| 347 symbol, \ | |
| 348 Symbol) \ | |
| 349 V(ASCII_SYMBOL_TYPE, \ | |
| 350 kVariableSizeSentinel, \ | |
| 351 ascii_symbol, \ | |
| 352 AsciiSymbol) \ | |
| 353 V(CONS_SYMBOL_TYPE, \ | |
| 354 ConsString::kSize, \ | |
| 355 cons_symbol, \ | |
| 356 ConsSymbol) \ | |
| 357 V(CONS_ASCII_SYMBOL_TYPE, \ | |
| 358 ConsString::kSize, \ | |
| 359 cons_ascii_symbol, \ | |
| 360 ConsAsciiSymbol) \ | |
| 361 V(EXTERNAL_SYMBOL_TYPE, \ | |
| 362 ExternalTwoByteString::kSize, \ | |
| 363 external_symbol, \ | |
| 364 ExternalSymbol) \ | |
| 365 V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE, \ | |
| 366 ExternalTwoByteString::kSize, \ | |
| 367 external_symbol_with_ascii_data, \ | |
| 368 ExternalSymbolWithAsciiData) \ | |
| 369 V(EXTERNAL_ASCII_SYMBOL_TYPE, \ | |
| 370 ExternalAsciiString::kSize, \ | |
| 371 external_ascii_symbol, \ | |
| 372 ExternalAsciiSymbol) \ | |
| 373 V(SHORT_EXTERNAL_SYMBOL_TYPE, \ | |
| 374 ExternalTwoByteString::kShortSize, \ | |
| 375 short_external_symbol, \ | |
| 376 ShortExternalSymbol) \ | |
| 377 V(SHORT_EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE, \ | |
| 378 ExternalTwoByteString::kShortSize, \ | |
| 379 short_external_symbol_with_ascii_data, \ | |
| 380 ShortExternalSymbolWithAsciiData) \ | |
| 381 V(SHORT_EXTERNAL_ASCII_SYMBOL_TYPE, \ | |
| 382 ExternalAsciiString::kShortSize, \ | |
| 383 short_external_ascii_symbol, \ | |
| 384 ShortExternalAsciiSymbol) \ | |
| 385 V(STRING_TYPE, \ | 345 V(STRING_TYPE, \ |
| 386 kVariableSizeSentinel, \ | 346 kVariableSizeSentinel, \ |
| 387 string, \ | 347 string, \ |
| 388 String) \ | 348 String) \ |
| 389 V(ASCII_STRING_TYPE, \ | 349 V(ASCII_STRING_TYPE, \ |
| 390 kVariableSizeSentinel, \ | 350 kVariableSizeSentinel, \ |
| 391 ascii_string, \ | 351 ascii_string, \ |
| 392 AsciiString) \ | 352 AsciiString) \ |
| 393 V(CONS_STRING_TYPE, \ | 353 V(CONS_STRING_TYPE, \ |
| 394 ConsString::kSize, \ | 354 ConsString::kSize, \ |
| 395 cons_string, \ | 355 cons_string, \ |
| 396 ConsString) \ | 356 ConsString) \ |
| 397 V(CONS_ASCII_STRING_TYPE, \ | 357 V(CONS_ASCII_STRING_TYPE, \ |
| 398 ConsString::kSize, \ | 358 ConsString::kSize, \ |
| 399 cons_ascii_string, \ | 359 cons_ascii_string, \ |
| 400 ConsAsciiString) \ | 360 ConsAsciiString) \ |
| 401 V(SLICED_STRING_TYPE, \ | 361 V(SLICED_STRING_TYPE, \ |
| 402 SlicedString::kSize, \ | 362 SlicedString::kSize, \ |
| 403 sliced_string, \ | 363 sliced_string, \ |
| 404 SlicedString) \ | 364 SlicedString) \ |
| 405 V(SLICED_ASCII_STRING_TYPE, \ | 365 V(SLICED_ASCII_STRING_TYPE, \ |
| 406 SlicedString::kSize, \ | 366 SlicedString::kSize, \ |
| 407 sliced_ascii_string, \ | 367 sliced_ascii_string, \ |
| 408 SlicedAsciiString) \ | 368 SlicedAsciiString) \ |
| 409 V(EXTERNAL_STRING_TYPE, \ | 369 V(EXTERNAL_STRING_TYPE, \ |
| 410 ExternalTwoByteString::kSize, \ | 370 ExternalTwoByteString::kSize, \ |
| 411 external_string, \ | 371 external_string, \ |
| 412 ExternalString) \ | 372 ExternalString) \ |
| 373 V(EXTERNAL_ASCII_STRING_TYPE, \ |
| 374 ExternalAsciiString::kSize, \ |
| 375 external_ascii_string, \ |
| 376 ExternalAsciiString) \ |
| 413 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ | 377 V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ |
| 414 ExternalTwoByteString::kSize, \ | 378 ExternalTwoByteString::kSize, \ |
| 415 external_string_with_ascii_data, \ | 379 external_string_with_ascii_data, \ |
| 416 ExternalStringWithAsciiData) \ | 380 ExternalStringWithAsciiData) \ |
| 417 V(EXTERNAL_ASCII_STRING_TYPE, \ | |
| 418 ExternalAsciiString::kSize, \ | |
| 419 external_ascii_string, \ | |
| 420 ExternalAsciiString) \ | |
| 421 V(SHORT_EXTERNAL_STRING_TYPE, \ | 381 V(SHORT_EXTERNAL_STRING_TYPE, \ |
| 422 ExternalTwoByteString::kShortSize, \ | 382 ExternalTwoByteString::kShortSize, \ |
| 423 short_external_string, \ | 383 short_external_string, \ |
| 424 ShortExternalString) \ | 384 ShortExternalString) \ |
| 385 V(SHORT_EXTERNAL_ASCII_STRING_TYPE, \ |
| 386 ExternalAsciiString::kShortSize, \ |
| 387 short_external_ascii_string, \ |
| 388 ShortExternalAsciiString) \ |
| 425 V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ | 389 V(SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE, \ |
| 426 ExternalTwoByteString::kShortSize, \ | 390 ExternalTwoByteString::kShortSize, \ |
| 427 short_external_string_with_ascii_data, \ | 391 short_external_string_with_ascii_data, \ |
| 428 ShortExternalStringWithAsciiData) \ | 392 ShortExternalStringWithAsciiData) \ |
| 429 V(SHORT_EXTERNAL_ASCII_STRING_TYPE, \ | 393 \ |
| 394 V(INTERNALIZED_STRING_TYPE, \ |
| 395 kVariableSizeSentinel, \ |
| 396 internalized_string, \ |
| 397 InternalizedString) \ |
| 398 V(ASCII_INTERNALIZED_STRING_TYPE, \ |
| 399 kVariableSizeSentinel, \ |
| 400 ascii_internalized_string, \ |
| 401 AsciiInternalizedString) \ |
| 402 V(CONS_INTERNALIZED_STRING_TYPE, \ |
| 403 ConsString::kSize, \ |
| 404 cons_internalized_string, \ |
| 405 ConsInternalizedString) \ |
| 406 V(CONS_ASCII_INTERNALIZED_STRING_TYPE, \ |
| 407 ConsString::kSize, \ |
| 408 cons_ascii_internalized_string, \ |
| 409 ConsAsciiInternalizedString) \ |
| 410 V(EXTERNAL_INTERNALIZED_STRING_TYPE, \ |
| 411 ExternalTwoByteString::kSize, \ |
| 412 external_internalized_string, \ |
| 413 ExternalInternalizedString) \ |
| 414 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE, \ |
| 415 ExternalAsciiString::kSize, \ |
| 416 external_ascii_internalized_string, \ |
| 417 ExternalAsciiInternalizedString) \ |
| 418 V(EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE, \ |
| 419 ExternalTwoByteString::kSize, \ |
| 420 external_internalized_string_with_ascii_data, \ |
| 421 ExternalInternalizedStringWithAsciiData) \ |
| 422 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \ |
| 423 ExternalTwoByteString::kShortSize, \ |
| 424 short_external_internalized_string, \ |
| 425 ShortExternalInternalizedString) \ |
| 426 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE, \ |
| 430 ExternalAsciiString::kShortSize, \ | 427 ExternalAsciiString::kShortSize, \ |
| 431 short_external_ascii_string, \ | 428 short_external_ascii_internalized_string, \ |
| 432 ShortExternalAsciiString) | 429 ShortExternalAsciiInternalizedString) \ |
| 430 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE, \ |
| 431 ExternalTwoByteString::kShortSize, \ |
| 432 short_external_internalized_string_with_ascii_data, \ |
| 433 ShortExternalInternalizedStringWithAsciiData) \ |
| 433 | 434 |
| 434 // A struct is a simple object a set of object-valued fields. Including an | 435 // A struct is a simple object a set of object-valued fields. Including an |
| 435 // object type in this causes the compiler to generate most of the boilerplate | 436 // object type in this causes the compiler to generate most of the boilerplate |
| 436 // code for the class including allocation and garbage collection routines, | 437 // code for the class including allocation and garbage collection routines, |
| 437 // casts and predicates. All you need to define is the class, methods and | 438 // casts and predicates. All you need to define is the class, methods and |
| 438 // object verification routines. Easy, no? | 439 // object verification routines. Easy, no? |
| 439 // | 440 // |
| 440 // Note that for subtle reasons related to the ordering or numerical values of | 441 // Note that for subtle reasons related to the ordering or numerical values of |
| 441 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 442 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
| 442 // manually. | 443 // manually. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 469 STRUCT_LIST_ALL(V) \ | 470 STRUCT_LIST_ALL(V) \ |
| 470 STRUCT_LIST_DEBUGGER(V) | 471 STRUCT_LIST_DEBUGGER(V) |
| 471 | 472 |
| 472 // We use the full 8 bits of the instance_type field to encode heap object | 473 // We use the full 8 bits of the instance_type field to encode heap object |
| 473 // instance types. The high-order bit (bit 7) is set if the object is not a | 474 // instance types. The high-order bit (bit 7) is set if the object is not a |
| 474 // string, and cleared if it is a string. | 475 // string, and cleared if it is a string. |
| 475 const uint32_t kIsNotStringMask = 0x80; | 476 const uint32_t kIsNotStringMask = 0x80; |
| 476 const uint32_t kStringTag = 0x0; | 477 const uint32_t kStringTag = 0x0; |
| 477 const uint32_t kNotStringTag = 0x80; | 478 const uint32_t kNotStringTag = 0x80; |
| 478 | 479 |
| 479 // Bit 6 indicates that the object is a symbol (if set) or not (if cleared). | 480 // Bit 6 indicates that the object is an internalized string (if set) or not. |
| 480 // There are not enough types that the non-string types (with bit 7 set) can | 481 // There are not enough types that the non-string types (with bit 7 set) can |
| 481 // have bit 6 set too. | 482 // have bit 6 set too. |
| 482 const uint32_t kIsSymbolMask = 0x40; | 483 const uint32_t kIsInternalizedMask = 0x40; |
| 483 const uint32_t kNotSymbolTag = 0x0; | 484 const uint32_t kNotInternalizedTag = 0x0; |
| 484 const uint32_t kSymbolTag = 0x40; | 485 const uint32_t kInternalizedTag = 0x40; |
| 485 | 486 |
| 486 // If bit 7 is clear then bit 2 indicates whether the string consists of | 487 // If bit 7 is clear then bit 2 indicates whether the string consists of |
| 487 // two-byte characters or one-byte characters. | 488 // two-byte characters or one-byte characters. |
| 488 const uint32_t kStringEncodingMask = 0x4; | 489 const uint32_t kStringEncodingMask = 0x4; |
| 489 const uint32_t kTwoByteStringTag = 0x0; | 490 const uint32_t kTwoByteStringTag = 0x0; |
| 490 const uint32_t kOneByteStringTag = 0x4; | 491 const uint32_t kOneByteStringTag = 0x4; |
| 491 | 492 |
| 492 // If bit 7 is clear, the low-order 2 bits indicate the representation | 493 // If bit 7 is clear, the low-order 2 bits indicate the representation |
| 493 // of the string. | 494 // of the string. |
| 494 const uint32_t kStringRepresentationMask = 0x03; | 495 const uint32_t kStringRepresentationMask = 0x03; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 517 const uint32_t kAsciiDataHintMask = 0x08; | 518 const uint32_t kAsciiDataHintMask = 0x08; |
| 518 const uint32_t kAsciiDataHintTag = 0x08; | 519 const uint32_t kAsciiDataHintTag = 0x08; |
| 519 | 520 |
| 520 // If bit 7 is clear and string representation indicates an external string, | 521 // If bit 7 is clear and string representation indicates an external string, |
| 521 // then bit 4 indicates whether the data pointer is cached. | 522 // then bit 4 indicates whether the data pointer is cached. |
| 522 const uint32_t kShortExternalStringMask = 0x10; | 523 const uint32_t kShortExternalStringMask = 0x10; |
| 523 const uint32_t kShortExternalStringTag = 0x10; | 524 const uint32_t kShortExternalStringTag = 0x10; |
| 524 | 525 |
| 525 | 526 |
| 526 // A ConsString with an empty string as the right side is a candidate | 527 // A ConsString with an empty string as the right side is a candidate |
| 527 // for being shortcut by the garbage collector unless it is a | 528 // for being shortcut by the garbage collector unless it is internalized. |
| 528 // symbol. It's not common to have non-flat symbols, so we do not | 529 // It's not common to have non-flat internalized strings, so we do not |
| 529 // shortcut them thereby avoiding turning symbols into strings. See | 530 // shortcut them thereby avoiding turning internalized strings into strings. |
| 530 // heap.cc and mark-compact.cc. | 531 // See heap.cc and mark-compact.cc. |
| 531 const uint32_t kShortcutTypeMask = | 532 const uint32_t kShortcutTypeMask = |
| 532 kIsNotStringMask | | 533 kIsNotStringMask | |
| 533 kIsSymbolMask | | 534 kIsInternalizedMask | |
| 534 kStringRepresentationMask; | 535 kStringRepresentationMask; |
| 535 const uint32_t kShortcutTypeTag = kConsStringTag; | 536 const uint32_t kShortcutTypeTag = kConsStringTag; |
| 536 | 537 |
| 537 | 538 |
| 538 enum InstanceType { | 539 enum InstanceType { |
| 539 // String types. | 540 // String types. |
| 540 SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kSeqStringTag, | |
| 541 ASCII_SYMBOL_TYPE = kOneByteStringTag | kSymbolTag | kSeqStringTag, | |
| 542 CONS_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kConsStringTag, | |
| 543 CONS_ASCII_SYMBOL_TYPE = kOneByteStringTag | kSymbolTag | kConsStringTag, | |
| 544 SHORT_EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | | |
| 545 kExternalStringTag | kShortExternalStringTag, | |
| 546 SHORT_EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | |
| 547 kTwoByteStringTag | kSymbolTag | kExternalStringTag | | |
| 548 kAsciiDataHintTag | kShortExternalStringTag, | |
| 549 SHORT_EXTERNAL_ASCII_SYMBOL_TYPE = kOneByteStringTag | kExternalStringTag | | |
| 550 kSymbolTag | kShortExternalStringTag, | |
| 551 EXTERNAL_SYMBOL_TYPE = kTwoByteStringTag | kSymbolTag | kExternalStringTag, | |
| 552 EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE = | |
| 553 kTwoByteStringTag | kSymbolTag | kExternalStringTag | kAsciiDataHintTag, | |
| 554 EXTERNAL_ASCII_SYMBOL_TYPE = | |
| 555 kOneByteStringTag | kSymbolTag | kExternalStringTag, | |
| 556 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, | 541 STRING_TYPE = kTwoByteStringTag | kSeqStringTag, |
| 557 ASCII_STRING_TYPE = kOneByteStringTag | kSeqStringTag, | 542 ASCII_STRING_TYPE = kOneByteStringTag | kSeqStringTag, |
| 558 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, | 543 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag, |
| 559 CONS_ASCII_STRING_TYPE = kOneByteStringTag | kConsStringTag, | 544 CONS_ASCII_STRING_TYPE = kOneByteStringTag | kConsStringTag, |
| 560 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag, | 545 SLICED_STRING_TYPE = kTwoByteStringTag | kSlicedStringTag, |
| 561 SLICED_ASCII_STRING_TYPE = kOneByteStringTag | kSlicedStringTag, | 546 SLICED_ASCII_STRING_TYPE = kOneByteStringTag | kSlicedStringTag, |
| 562 SHORT_EXTERNAL_STRING_TYPE = | 547 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, |
| 563 kTwoByteStringTag | kExternalStringTag | kShortExternalStringTag, | 548 EXTERNAL_ASCII_STRING_TYPE = kOneByteStringTag | kExternalStringTag, |
| 549 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = |
| 550 EXTERNAL_STRING_TYPE | kAsciiDataHintTag, |
| 551 SHORT_EXTERNAL_STRING_TYPE = EXTERNAL_STRING_TYPE | kShortExternalStringTag, |
| 552 SHORT_EXTERNAL_ASCII_STRING_TYPE = |
| 553 EXTERNAL_ASCII_STRING_TYPE | kShortExternalStringTag, |
| 564 SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = | 554 SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = |
| 565 kTwoByteStringTag | kExternalStringTag | | 555 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kShortExternalStringTag, |
| 566 kAsciiDataHintTag | kShortExternalStringTag, | 556 |
| 567 SHORT_EXTERNAL_ASCII_STRING_TYPE = | 557 INTERNALIZED_STRING_TYPE = STRING_TYPE | kInternalizedTag, |
| 568 kOneByteStringTag | kExternalStringTag | kShortExternalStringTag, | 558 ASCII_INTERNALIZED_STRING_TYPE = ASCII_STRING_TYPE | kInternalizedTag, |
| 569 EXTERNAL_STRING_TYPE = kTwoByteStringTag | kExternalStringTag, | 559 CONS_INTERNALIZED_STRING_TYPE = CONS_STRING_TYPE | kInternalizedTag, |
| 570 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE = | 560 CONS_ASCII_INTERNALIZED_STRING_TYPE = |
| 571 kTwoByteStringTag | kExternalStringTag | kAsciiDataHintTag, | 561 CONS_ASCII_STRING_TYPE | kInternalizedTag, |
| 572 // LAST_STRING_TYPE | 562 EXTERNAL_INTERNALIZED_STRING_TYPE = EXTERNAL_STRING_TYPE | kInternalizedTag, |
| 573 EXTERNAL_ASCII_STRING_TYPE = kOneByteStringTag | kExternalStringTag, | 563 EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = |
| 574 PRIVATE_EXTERNAL_ASCII_STRING_TYPE = EXTERNAL_ASCII_STRING_TYPE, | 564 EXTERNAL_ASCII_STRING_TYPE | kInternalizedTag, |
| 565 EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE = |
| 566 EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kInternalizedTag, |
| 567 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE = |
| 568 SHORT_EXTERNAL_STRING_TYPE | kInternalizedTag, |
| 569 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = |
| 570 SHORT_EXTERNAL_ASCII_STRING_TYPE | kInternalizedTag, |
| 571 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ASCII_DATA_TYPE = |
| 572 SHORT_EXTERNAL_STRING_WITH_ASCII_DATA_TYPE | kInternalizedTag, |
| 575 | 573 |
| 576 // Objects allocated in their own spaces (never in new space). | 574 // Objects allocated in their own spaces (never in new space). |
| 577 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE | 575 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE |
| 578 CODE_TYPE, | 576 CODE_TYPE, |
| 579 ODDBALL_TYPE, | 577 ODDBALL_TYPE, |
| 580 JS_GLOBAL_PROPERTY_CELL_TYPE, | 578 JS_GLOBAL_PROPERTY_CELL_TYPE, |
| 581 | 579 |
| 582 // "Data", objects that cannot contain non-map-word pointers to heap | 580 // "Data", objects that cannot contain non-map-word pointers to heap |
| 583 // objects. | 581 // objects. |
| 584 HEAP_NUMBER_TYPE, | 582 HEAP_NUMBER_TYPE, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); | 691 STATIC_CHECK(FOREIGN_TYPE == Internals::kForeignType); |
| 694 | 692 |
| 695 | 693 |
| 696 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ | 694 #define FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(V) \ |
| 697 V(FAST_ELEMENTS_SUB_TYPE) \ | 695 V(FAST_ELEMENTS_SUB_TYPE) \ |
| 698 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ | 696 V(DICTIONARY_ELEMENTS_SUB_TYPE) \ |
| 699 V(FAST_PROPERTIES_SUB_TYPE) \ | 697 V(FAST_PROPERTIES_SUB_TYPE) \ |
| 700 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ | 698 V(DICTIONARY_PROPERTIES_SUB_TYPE) \ |
| 701 V(MAP_CODE_CACHE_SUB_TYPE) \ | 699 V(MAP_CODE_CACHE_SUB_TYPE) \ |
| 702 V(SCOPE_INFO_SUB_TYPE) \ | 700 V(SCOPE_INFO_SUB_TYPE) \ |
| 703 V(SYMBOL_TABLE_SUB_TYPE) \ | 701 V(STRING_TABLE_SUB_TYPE) \ |
| 704 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ | 702 V(DESCRIPTOR_ARRAY_SUB_TYPE) \ |
| 705 V(TRANSITION_ARRAY_SUB_TYPE) | 703 V(TRANSITION_ARRAY_SUB_TYPE) |
| 706 | 704 |
| 707 enum FixedArraySubInstanceType { | 705 enum FixedArraySubInstanceType { |
| 708 #define DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE(name) name, | 706 #define DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE(name) name, |
| 709 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE) | 707 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE) |
| 710 #undef DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE | 708 #undef DEFINE_FIXED_ARRAY_SUB_INSTANCE_TYPE |
| 711 LAST_FIXED_ARRAY_SUB_TYPE = TRANSITION_ARRAY_SUB_TYPE | 709 LAST_FIXED_ARRAY_SUB_TYPE = TRANSITION_ARRAY_SUB_TYPE |
| 712 }; | 710 }; |
| 713 | 711 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 | 822 |
| 825 | 823 |
| 826 #define OBJECT_TYPE_LIST(V) \ | 824 #define OBJECT_TYPE_LIST(V) \ |
| 827 V(Smi) \ | 825 V(Smi) \ |
| 828 V(HeapObject) \ | 826 V(HeapObject) \ |
| 829 V(Number) \ | 827 V(Number) \ |
| 830 | 828 |
| 831 #define HEAP_OBJECT_TYPE_LIST(V) \ | 829 #define HEAP_OBJECT_TYPE_LIST(V) \ |
| 832 V(HeapNumber) \ | 830 V(HeapNumber) \ |
| 833 V(String) \ | 831 V(String) \ |
| 834 V(Symbol) \ | |
| 835 V(SeqString) \ | 832 V(SeqString) \ |
| 836 V(ExternalString) \ | 833 V(ExternalString) \ |
| 837 V(ConsString) \ | 834 V(ConsString) \ |
| 838 V(SlicedString) \ | 835 V(SlicedString) \ |
| 839 V(ExternalTwoByteString) \ | 836 V(ExternalTwoByteString) \ |
| 840 V(ExternalAsciiString) \ | 837 V(ExternalAsciiString) \ |
| 841 V(SeqTwoByteString) \ | 838 V(SeqTwoByteString) \ |
| 842 V(SeqOneByteString) \ | 839 V(SeqOneByteString) \ |
| 840 V(InternalizedString) \ |
| 843 \ | 841 \ |
| 844 V(ExternalArray) \ | 842 V(ExternalArray) \ |
| 845 V(ExternalByteArray) \ | 843 V(ExternalByteArray) \ |
| 846 V(ExternalUnsignedByteArray) \ | 844 V(ExternalUnsignedByteArray) \ |
| 847 V(ExternalShortArray) \ | 845 V(ExternalShortArray) \ |
| 848 V(ExternalUnsignedShortArray) \ | 846 V(ExternalUnsignedShortArray) \ |
| 849 V(ExternalIntArray) \ | 847 V(ExternalIntArray) \ |
| 850 V(ExternalUnsignedIntArray) \ | 848 V(ExternalUnsignedIntArray) \ |
| 851 V(ExternalFloatArray) \ | 849 V(ExternalFloatArray) \ |
| 852 V(ExternalDoubleArray) \ | 850 V(ExternalDoubleArray) \ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 881 V(Boolean) \ | 879 V(Boolean) \ |
| 882 V(JSArray) \ | 880 V(JSArray) \ |
| 883 V(JSProxy) \ | 881 V(JSProxy) \ |
| 884 V(JSFunctionProxy) \ | 882 V(JSFunctionProxy) \ |
| 885 V(JSSet) \ | 883 V(JSSet) \ |
| 886 V(JSMap) \ | 884 V(JSMap) \ |
| 887 V(JSWeakMap) \ | 885 V(JSWeakMap) \ |
| 888 V(JSRegExp) \ | 886 V(JSRegExp) \ |
| 889 V(HashTable) \ | 887 V(HashTable) \ |
| 890 V(Dictionary) \ | 888 V(Dictionary) \ |
| 891 V(SymbolTable) \ | 889 V(StringTable) \ |
| 892 V(JSFunctionResultCache) \ | 890 V(JSFunctionResultCache) \ |
| 893 V(NormalizedMapCache) \ | 891 V(NormalizedMapCache) \ |
| 894 V(CompilationCacheTable) \ | 892 V(CompilationCacheTable) \ |
| 895 V(CodeCacheHashTable) \ | 893 V(CodeCacheHashTable) \ |
| 896 V(PolymorphicCodeCacheHashTable) \ | 894 V(PolymorphicCodeCacheHashTable) \ |
| 897 V(MapCache) \ | 895 V(MapCache) \ |
| 898 V(Primitive) \ | 896 V(Primitive) \ |
| 899 V(GlobalObject) \ | 897 V(GlobalObject) \ |
| 900 V(JSGlobalObject) \ | 898 V(JSGlobalObject) \ |
| 901 V(JSBuiltinsObject) \ | 899 V(JSBuiltinsObject) \ |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 bool IsDirty(); | 1777 bool IsDirty(); |
| 1780 | 1778 |
| 1781 // If the receiver is a JSGlobalProxy this method will return its prototype, | 1779 // If the receiver is a JSGlobalProxy this method will return its prototype, |
| 1782 // otherwise the result is the receiver itself. | 1780 // otherwise the result is the receiver itself. |
| 1783 inline Object* BypassGlobalProxy(); | 1781 inline Object* BypassGlobalProxy(); |
| 1784 | 1782 |
| 1785 // Accessors for hidden properties object. | 1783 // Accessors for hidden properties object. |
| 1786 // | 1784 // |
| 1787 // Hidden properties are not local properties of the object itself. | 1785 // Hidden properties are not local properties of the object itself. |
| 1788 // Instead they are stored in an auxiliary structure kept as a local | 1786 // Instead they are stored in an auxiliary structure kept as a local |
| 1789 // property with a special name Heap::hidden_symbol(). But if the | 1787 // property with a special name Heap::hidden_string(). But if the |
| 1790 // receiver is a JSGlobalProxy then the auxiliary object is a property | 1788 // receiver is a JSGlobalProxy then the auxiliary object is a property |
| 1791 // of its prototype, and if it's a detached proxy, then you can't have | 1789 // of its prototype, and if it's a detached proxy, then you can't have |
| 1792 // hidden properties. | 1790 // hidden properties. |
| 1793 | 1791 |
| 1794 // Sets a hidden property on this object. Returns this object if successful, | 1792 // Sets a hidden property on this object. Returns this object if successful, |
| 1795 // undefined if called on a detached proxy. | 1793 // undefined if called on a detached proxy. |
| 1796 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj, | 1794 static Handle<Object> SetHiddenProperty(Handle<JSObject> obj, |
| 1797 Handle<String> key, | 1795 Handle<String> key, |
| 1798 Handle<Object> value); | 1796 Handle<Object> value); |
| 1799 // Returns a failure if a GC is required. | 1797 // Returns a failure if a GC is required. |
| 1800 MUST_USE_RESULT MaybeObject* SetHiddenProperty(String* key, Object* value); | 1798 MUST_USE_RESULT MaybeObject* SetHiddenProperty(String* key, Object* value); |
| 1801 // Gets the value of a hidden property with the given key. Returns undefined | 1799 // Gets the value of a hidden property with the given key. Returns undefined |
| 1802 // if the property doesn't exist (or if called on a detached proxy), | 1800 // if the property doesn't exist (or if called on a detached proxy), |
| 1803 // otherwise returns the value set for the key. | 1801 // otherwise returns the value set for the key. |
| 1804 Object* GetHiddenProperty(String* key); | 1802 Object* GetHiddenProperty(String* key); |
| 1805 // Deletes a hidden property. Deleting a non-existing property is | 1803 // Deletes a hidden property. Deleting a non-existing property is |
| 1806 // considered successful. | 1804 // considered successful. |
| 1807 void DeleteHiddenProperty(String* key); | 1805 void DeleteHiddenProperty(String* key); |
| 1808 // Returns true if the object has a property with the hidden symbol as name. | 1806 // Returns true if the object has a property with the hidden string as name. |
| 1809 bool HasHiddenProperties(); | 1807 bool HasHiddenProperties(); |
| 1810 | 1808 |
| 1811 static int GetIdentityHash(Handle<JSObject> obj); | 1809 static int GetIdentityHash(Handle<JSObject> obj); |
| 1812 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); | 1810 MUST_USE_RESULT MaybeObject* GetIdentityHash(CreationFlag flag); |
| 1813 MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag); | 1811 MUST_USE_RESULT MaybeObject* SetIdentityHash(Smi* hash, CreationFlag flag); |
| 1814 | 1812 |
| 1815 static Handle<Object> DeleteProperty(Handle<JSObject> obj, | 1813 static Handle<Object> DeleteProperty(Handle<JSObject> obj, |
| 1816 Handle<String> name); | 1814 Handle<String> name); |
| 1817 // Can cause GC. | 1815 // Can cause GC. |
| 1818 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); | 1816 MUST_USE_RESULT MaybeObject* DeleteProperty(String* name, DeleteMode mode); |
| (...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 // Returns the hash value for object. | 2995 // Returns the hash value for object. |
| 2998 virtual uint32_t HashForObject(Object* key) = 0; | 2996 virtual uint32_t HashForObject(Object* key) = 0; |
| 2999 // Returns the key object for storing into the hash table. | 2997 // Returns the key object for storing into the hash table. |
| 3000 // If allocations fails a failure object is returned. | 2998 // If allocations fails a failure object is returned. |
| 3001 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; | 2999 MUST_USE_RESULT virtual MaybeObject* AsObject() = 0; |
| 3002 // Required. | 3000 // Required. |
| 3003 virtual ~HashTableKey() {} | 3001 virtual ~HashTableKey() {} |
| 3004 }; | 3002 }; |
| 3005 | 3003 |
| 3006 | 3004 |
| 3007 class SymbolTableShape : public BaseShape<HashTableKey*> { | 3005 class StringTableShape : public BaseShape<HashTableKey*> { |
| 3008 public: | 3006 public: |
| 3009 static inline bool IsMatch(HashTableKey* key, Object* value) { | 3007 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 3010 return key->IsMatch(value); | 3008 return key->IsMatch(value); |
| 3011 } | 3009 } |
| 3012 static inline uint32_t Hash(HashTableKey* key) { | 3010 static inline uint32_t Hash(HashTableKey* key) { |
| 3013 return key->Hash(); | 3011 return key->Hash(); |
| 3014 } | 3012 } |
| 3015 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 3013 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 3016 return key->HashForObject(object); | 3014 return key->HashForObject(object); |
| 3017 } | 3015 } |
| 3018 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { | 3016 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 3019 return key->AsObject(); | 3017 return key->AsObject(); |
| 3020 } | 3018 } |
| 3021 | 3019 |
| 3022 static const int kPrefixSize = 0; | 3020 static const int kPrefixSize = 0; |
| 3023 static const int kEntrySize = 1; | 3021 static const int kEntrySize = 1; |
| 3024 }; | 3022 }; |
| 3025 | 3023 |
| 3026 class SeqOneByteString; | 3024 class SeqOneByteString; |
| 3027 | 3025 |
| 3028 // SymbolTable. | 3026 // StringTable. |
| 3029 // | 3027 // |
| 3030 // No special elements in the prefix and the element size is 1 | 3028 // No special elements in the prefix and the element size is 1 |
| 3031 // because only the symbol itself (the key) needs to be stored. | 3029 // because only the string itself (the key) needs to be stored. |
| 3032 class SymbolTable: public HashTable<SymbolTableShape, HashTableKey*> { | 3030 class StringTable: public HashTable<StringTableShape, HashTableKey*> { |
| 3033 public: | 3031 public: |
| 3034 // Find symbol in the symbol table. If it is not there yet, it is | 3032 // Find string in the string table. If it is not there yet, it is |
| 3035 // added. The return value is the symbol table which might have | 3033 // added. The return value is the string table which might have |
| 3036 // been enlarged. If the return value is not a failure, the symbol | 3034 // been enlarged. If the return value is not a failure, the string |
| 3037 // pointer *s is set to the symbol found. | 3035 // pointer *s is set to the string found. |
| 3038 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str, | 3036 MUST_USE_RESULT MaybeObject* LookupUtf8String( |
| 3039 Object** s); | 3037 Vector<const char> str, |
| 3040 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const uint8_t> str, | 3038 Object** s); |
| 3041 Object** s); | 3039 MUST_USE_RESULT MaybeObject* LookupOneByteString( |
| 3042 MUST_USE_RESULT MaybeObject* LookupSubStringOneByteSymbol( | 3040 Vector<const uint8_t> str, |
| 3041 Object** s); |
| 3042 MUST_USE_RESULT MaybeObject* LookupSubStringOneByteString( |
| 3043 Handle<SeqOneByteString> str, | 3043 Handle<SeqOneByteString> str, |
| 3044 int from, | 3044 int from, |
| 3045 int length, | 3045 int length, |
| 3046 Object** s); | 3046 Object** s); |
| 3047 MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str, | 3047 MUST_USE_RESULT MaybeObject* LookupTwoByteString( |
| 3048 Object** s); | 3048 Vector<const uc16> str, |
| 3049 Object** s); |
| 3049 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); | 3050 MUST_USE_RESULT MaybeObject* LookupString(String* key, Object** s); |
| 3050 | 3051 |
| 3051 // Looks up a symbol that is equal to the given string and returns | 3052 // Looks up a string that is equal to the given string and returns |
| 3052 // true if it is found, assigning the symbol to the given output | 3053 // true if it is found, assigning the string to the given output |
| 3053 // parameter. | 3054 // parameter. |
| 3054 bool LookupSymbolIfExists(String* str, String** symbol); | 3055 bool LookupStringIfExists(String* str, String** result); |
| 3055 bool LookupTwoCharsSymbolIfExists(uint16_t c1, uint16_t c2, String** symbol); | 3056 bool LookupTwoCharsStringIfExists(uint16_t c1, uint16_t c2, String** result); |
| 3056 | 3057 |
| 3057 // Casting. | 3058 // Casting. |
| 3058 static inline SymbolTable* cast(Object* obj); | 3059 static inline StringTable* cast(Object* obj); |
| 3059 | 3060 |
| 3060 private: | 3061 private: |
| 3061 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); | 3062 MUST_USE_RESULT MaybeObject* LookupKey(HashTableKey* key, Object** s); |
| 3062 | 3063 |
| 3063 template <bool seq_ascii> friend class JsonParser; | 3064 template <bool seq_ascii> friend class JsonParser; |
| 3064 | 3065 |
| 3065 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolTable); | 3066 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); |
| 3066 }; | 3067 }; |
| 3067 | 3068 |
| 3068 | 3069 |
| 3069 class MapCacheShape : public BaseShape<HashTableKey*> { | 3070 class MapCacheShape : public BaseShape<HashTableKey*> { |
| 3070 public: | 3071 public: |
| 3071 static inline bool IsMatch(HashTableKey* key, Object* value) { | 3072 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 3072 return key->IsMatch(value); | 3073 return key->IsMatch(value); |
| 3073 } | 3074 } |
| 3074 static inline uint32_t Hash(HashTableKey* key) { | 3075 static inline uint32_t Hash(HashTableKey* key) { |
| 3075 return key->Hash(); | 3076 return key->Hash(); |
| 3076 } | 3077 } |
| 3077 | 3078 |
| 3078 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { | 3079 static inline uint32_t HashForObject(HashTableKey* key, Object* object) { |
| 3079 return key->HashForObject(object); | 3080 return key->HashForObject(object); |
| 3080 } | 3081 } |
| 3081 | 3082 |
| 3082 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { | 3083 MUST_USE_RESULT static inline MaybeObject* AsObject(HashTableKey* key) { |
| 3083 return key->AsObject(); | 3084 return key->AsObject(); |
| 3084 } | 3085 } |
| 3085 | 3086 |
| 3086 static const int kPrefixSize = 0; | 3087 static const int kPrefixSize = 0; |
| 3087 static const int kEntrySize = 2; | 3088 static const int kEntrySize = 2; |
| 3088 }; | 3089 }; |
| 3089 | 3090 |
| 3090 | 3091 |
| 3091 // MapCache. | 3092 // MapCache. |
| 3092 // | 3093 // |
| 3093 // Maps keys that are a fixed array of symbols to a map. | 3094 // Maps keys that are a fixed array of internalized strings to a map. |
| 3094 // Used for canonicalize maps for object literals. | 3095 // Used for canonicalize maps for object literals. |
| 3095 class MapCache: public HashTable<MapCacheShape, HashTableKey*> { | 3096 class MapCache: public HashTable<MapCacheShape, HashTableKey*> { |
| 3096 public: | 3097 public: |
| 3097 // Find cached value for a string key, otherwise return null. | 3098 // Find cached value for a string key, otherwise return null. |
| 3098 Object* Lookup(FixedArray* key); | 3099 Object* Lookup(FixedArray* key); |
| 3099 MUST_USE_RESULT MaybeObject* Put(FixedArray* key, Map* value); | 3100 MUST_USE_RESULT MaybeObject* Put(FixedArray* key, Map* value); |
| 3100 static inline MapCache* cast(Object* obj); | 3101 static inline MapCache* cast(Object* obj); |
| 3101 | 3102 |
| 3102 private: | 3103 private: |
| 3103 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); | 3104 DISALLOW_IMPLICIT_CONSTRUCTORS(MapCache); |
| (...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3516 String* ContextLocalName(int var); | 3517 String* ContextLocalName(int var); |
| 3517 | 3518 |
| 3518 // Return the mode of the given context local. | 3519 // Return the mode of the given context local. |
| 3519 VariableMode ContextLocalMode(int var); | 3520 VariableMode ContextLocalMode(int var); |
| 3520 | 3521 |
| 3521 // Return the initialization flag of the given context local. | 3522 // Return the initialization flag of the given context local. |
| 3522 InitializationFlag ContextLocalInitFlag(int var); | 3523 InitializationFlag ContextLocalInitFlag(int var); |
| 3523 | 3524 |
| 3524 // Lookup support for serialized scope info. Returns the | 3525 // Lookup support for serialized scope info. Returns the |
| 3525 // the stack slot index for a given slot name if the slot is | 3526 // the stack slot index for a given slot name if the slot is |
| 3526 // present; otherwise returns a value < 0. The name must be a symbol | 3527 // present; otherwise returns a value < 0. The name must be an internalized |
| 3527 // (canonicalized). | 3528 // string. |
| 3528 int StackSlotIndex(String* name); | 3529 int StackSlotIndex(String* name); |
| 3529 | 3530 |
| 3530 // Lookup support for serialized scope info. Returns the | 3531 // Lookup support for serialized scope info. Returns the |
| 3531 // context slot index for a given slot name if the slot is present; otherwise | 3532 // context slot index for a given slot name if the slot is present; otherwise |
| 3532 // returns a value < 0. The name must be a symbol (canonicalized). | 3533 // returns a value < 0. The name must be an internalized string. |
| 3533 // If the slot is present and mode != NULL, sets *mode to the corresponding | 3534 // If the slot is present and mode != NULL, sets *mode to the corresponding |
| 3534 // mode for that variable. | 3535 // mode for that variable. |
| 3535 int ContextSlotIndex(String* name, | 3536 int ContextSlotIndex(String* name, |
| 3536 VariableMode* mode, | 3537 VariableMode* mode, |
| 3537 InitializationFlag* init_flag); | 3538 InitializationFlag* init_flag); |
| 3538 | 3539 |
| 3539 // Lookup support for serialized scope info. Returns the | 3540 // Lookup support for serialized scope info. Returns the |
| 3540 // parameter index for a given parameter name if the parameter is present; | 3541 // parameter index for a given parameter name if the parameter is present; |
| 3541 // otherwise returns a value < 0. The name must be a symbol (canonicalized). | 3542 // otherwise returns a value < 0. The name must be an internalized string. |
| 3542 int ParameterIndex(String* name); | 3543 int ParameterIndex(String* name); |
| 3543 | 3544 |
| 3544 // Lookup support for serialized scope info. Returns the function context | 3545 // Lookup support for serialized scope info. Returns the function context |
| 3545 // slot index if the function name is present and context-allocated (named | 3546 // slot index if the function name is present and context-allocated (named |
| 3546 // function expressions, only), otherwise returns a value < 0. The name | 3547 // function expressions, only), otherwise returns a value < 0. The name |
| 3547 // must be a symbol (canonicalized). | 3548 // must be an internalized string. |
| 3548 int FunctionContextSlotIndex(String* name, VariableMode* mode); | 3549 int FunctionContextSlotIndex(String* name, VariableMode* mode); |
| 3549 | 3550 |
| 3550 static Handle<ScopeInfo> Create(Scope* scope, Zone* zone); | 3551 static Handle<ScopeInfo> Create(Scope* scope, Zone* zone); |
| 3551 | 3552 |
| 3552 // Serializes empty scope info. | 3553 // Serializes empty scope info. |
| 3553 static ScopeInfo* Empty(); | 3554 static ScopeInfo* Empty(); |
| 3554 | 3555 |
| 3555 #ifdef DEBUG | 3556 #ifdef DEBUG |
| 3556 void Print(); | 3557 void Print(); |
| 3557 #endif | 3558 #endif |
| (...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7092 inline explicit StringShape(InstanceType t); | 7093 inline explicit StringShape(InstanceType t); |
| 7093 inline bool IsSequential(); | 7094 inline bool IsSequential(); |
| 7094 inline bool IsExternal(); | 7095 inline bool IsExternal(); |
| 7095 inline bool IsCons(); | 7096 inline bool IsCons(); |
| 7096 inline bool IsSliced(); | 7097 inline bool IsSliced(); |
| 7097 inline bool IsIndirect(); | 7098 inline bool IsIndirect(); |
| 7098 inline bool IsExternalAscii(); | 7099 inline bool IsExternalAscii(); |
| 7099 inline bool IsExternalTwoByte(); | 7100 inline bool IsExternalTwoByte(); |
| 7100 inline bool IsSequentialAscii(); | 7101 inline bool IsSequentialAscii(); |
| 7101 inline bool IsSequentialTwoByte(); | 7102 inline bool IsSequentialTwoByte(); |
| 7102 inline bool IsSymbol(); | 7103 inline bool IsInternalized(); |
| 7103 inline StringRepresentationTag representation_tag(); | 7104 inline StringRepresentationTag representation_tag(); |
| 7104 inline uint32_t encoding_tag(); | 7105 inline uint32_t encoding_tag(); |
| 7105 inline uint32_t full_representation_tag(); | 7106 inline uint32_t full_representation_tag(); |
| 7106 inline uint32_t size_tag(); | 7107 inline uint32_t size_tag(); |
| 7107 #ifdef DEBUG | 7108 #ifdef DEBUG |
| 7108 inline uint32_t type() { return type_; } | 7109 inline uint32_t type() { return type_; } |
| 7109 inline void invalidate() { valid_ = false; } | 7110 inline void invalidate() { valid_ = false; } |
| 7110 inline bool valid() { return valid_; } | 7111 inline bool valid() { return valid_; } |
| 7111 #else | 7112 #else |
| 7112 inline void invalidate() { } | 7113 inline void invalidate() { } |
| (...skipping 1641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8754 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); | 8755 DISALLOW_IMPLICIT_CONSTRUCTORS(BreakPointInfo); |
| 8755 }; | 8756 }; |
| 8756 #endif // ENABLE_DEBUGGER_SUPPORT | 8757 #endif // ENABLE_DEBUGGER_SUPPORT |
| 8757 | 8758 |
| 8758 | 8759 |
| 8759 #undef DECL_BOOLEAN_ACCESSORS | 8760 #undef DECL_BOOLEAN_ACCESSORS |
| 8760 #undef DECL_ACCESSORS | 8761 #undef DECL_ACCESSORS |
| 8761 #undef DECLARE_VERIFIER | 8762 #undef DECLARE_VERIFIER |
| 8762 | 8763 |
| 8763 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ | 8764 #define VISITOR_SYNCHRONIZATION_TAGS_LIST(V) \ |
| 8764 V(kSymbolTable, "symbol_table", "(Symbols)") \ | 8765 V(kStringTable, "string_table", "(Internalized strings)") \ |
| 8765 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ | 8766 V(kExternalStringsTable, "external_strings_table", "(External strings)") \ |
| 8766 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ | 8767 V(kStrongRootList, "strong_root_list", "(Strong roots)") \ |
| 8767 V(kSymbol, "symbol", "(Symbol)") \ | 8768 V(kInternalizedString, "internalized_string", "(Internal string)") \ |
| 8768 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ | 8769 V(kBootstrapper, "bootstrapper", "(Bootstrapper)") \ |
| 8769 V(kTop, "top", "(Isolate)") \ | 8770 V(kTop, "top", "(Isolate)") \ |
| 8770 V(kRelocatable, "relocatable", "(Relocatable)") \ | 8771 V(kRelocatable, "relocatable", "(Relocatable)") \ |
| 8771 V(kDebug, "debug", "(Debugger)") \ | 8772 V(kDebug, "debug", "(Debugger)") \ |
| 8772 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ | 8773 V(kCompilationCache, "compilationcache", "(Compilation cache)") \ |
| 8773 V(kHandleScope, "handlescope", "(Handle scope)") \ | 8774 V(kHandleScope, "handlescope", "(Handle scope)") \ |
| 8774 V(kBuiltins, "builtins", "(Builtins)") \ | 8775 V(kBuiltins, "builtins", "(Builtins)") \ |
| 8775 V(kGlobalHandles, "globalhandles", "(Global handles)") \ | 8776 V(kGlobalHandles, "globalhandles", "(Global handles)") \ |
| 8776 V(kThreadManager, "threadmanager", "(Thread manager)") \ | 8777 V(kThreadManager, "threadmanager", "(Thread manager)") \ |
| 8777 V(kExtensions, "Extensions", "(Extensions)") | 8778 V(kExtensions, "Extensions", "(Extensions)") |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8885 } else { | 8886 } else { |
| 8886 value &= ~(1 << bit_position); | 8887 value &= ~(1 << bit_position); |
| 8887 } | 8888 } |
| 8888 return value; | 8889 return value; |
| 8889 } | 8890 } |
| 8890 }; | 8891 }; |
| 8891 | 8892 |
| 8892 } } // namespace v8::internal | 8893 } } // namespace v8::internal |
| 8893 | 8894 |
| 8894 #endif // V8_OBJECTS_H_ | 8895 #endif // V8_OBJECTS_H_ |
| OLD | NEW |