| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
| 6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/assert-scope.h" | 9 #include "src/assert-scope.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // - ExternalUint32Array | 93 // - ExternalUint32Array |
| 94 // - ExternalFloat32Array | 94 // - ExternalFloat32Array |
| 95 // - Name | 95 // - Name |
| 96 // - String | 96 // - String |
| 97 // - SeqString | 97 // - SeqString |
| 98 // - SeqOneByteString | 98 // - SeqOneByteString |
| 99 // - SeqTwoByteString | 99 // - SeqTwoByteString |
| 100 // - SlicedString | 100 // - SlicedString |
| 101 // - ConsString | 101 // - ConsString |
| 102 // - ExternalString | 102 // - ExternalString |
| 103 // - ExternalAsciiString | 103 // - ExternalOneByteString |
| 104 // - ExternalTwoByteString | 104 // - ExternalTwoByteString |
| 105 // - InternalizedString | 105 // - InternalizedString |
| 106 // - SeqInternalizedString | 106 // - SeqInternalizedString |
| 107 // - SeqOneByteInternalizedString | 107 // - SeqOneByteInternalizedString |
| 108 // - SeqTwoByteInternalizedString | 108 // - SeqTwoByteInternalizedString |
| 109 // - ConsInternalizedString | 109 // - ConsInternalizedString |
| 110 // - ExternalInternalizedString | 110 // - ExternalInternalizedString |
| 111 // - ExternalAsciiInternalizedString | 111 // - ExternalOneByteInternalizedString |
| 112 // - ExternalTwoByteInternalizedString | 112 // - ExternalTwoByteInternalizedString |
| 113 // - Symbol | 113 // - Symbol |
| 114 // - HeapNumber | 114 // - HeapNumber |
| 115 // - Cell | 115 // - Cell |
| 116 // - PropertyCell | 116 // - PropertyCell |
| 117 // - Code | 117 // - Code |
| 118 // - Map | 118 // - Map |
| 119 // - Oddball | 119 // - Oddball |
| 120 // - Foreign | 120 // - Foreign |
| 121 // - SharedFunctionInfo | 121 // - SharedFunctionInfo |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; | 312 const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1; |
| 313 | 313 |
| 314 // All Maps have a field instance_type containing a InstanceType. | 314 // All Maps have a field instance_type containing a InstanceType. |
| 315 // It describes the type of the instances. | 315 // It describes the type of the instances. |
| 316 // | 316 // |
| 317 // As an example, a JavaScript object is a heap object and its map | 317 // As an example, a JavaScript object is a heap object and its map |
| 318 // instance_type is JS_OBJECT_TYPE. | 318 // instance_type is JS_OBJECT_TYPE. |
| 319 // | 319 // |
| 320 // The names of the string instance types are intended to systematically | 320 // The names of the string instance types are intended to systematically |
| 321 // mirror their encoding in the instance_type field of the map. The default | 321 // mirror their encoding in the instance_type field of the map. The default |
| 322 // encoding is considered TWO_BYTE. It is not mentioned in the name. ASCII | 322 // encoding is considered TWO_BYTE. It is not mentioned in the name. ONE_BYTE |
| 323 // encoding is mentioned explicitly in the name. Likewise, the default | 323 // encoding is mentioned explicitly in the name. Likewise, the default |
| 324 // representation is considered sequential. It is not mentioned in the | 324 // representation is considered sequential. It is not mentioned in the |
| 325 // name. The other representations (e.g. CONS, EXTERNAL) are explicitly | 325 // name. The other representations (e.g. CONS, EXTERNAL) are explicitly |
| 326 // mentioned. Finally, the string is either a STRING_TYPE (if it is a normal | 326 // mentioned. Finally, the string is either a STRING_TYPE (if it is a normal |
| 327 // string) or a INTERNALIZED_STRING_TYPE (if it is a internalized string). | 327 // string) or a INTERNALIZED_STRING_TYPE (if it is a internalized string). |
| 328 // | 328 // |
| 329 // NOTE: The following things are some that depend on the string types having | 329 // NOTE: The following things are some that depend on the string types having |
| 330 // instance_types that are less than those of all other types: | 330 // instance_types that are less than those of all other types: |
| 331 // HeapObject::Size, HeapObject::IterateBody, the typeof operator, and | 331 // HeapObject::Size, HeapObject::IterateBody, the typeof operator, and |
| 332 // Object::IsString. | 332 // Object::IsString. |
| 333 // | 333 // |
| 334 // NOTE: Everything following JS_VALUE_TYPE is considered a | 334 // NOTE: Everything following JS_VALUE_TYPE is considered a |
| 335 // JSObject for GC purposes. The first four entries here have typeof | 335 // JSObject for GC purposes. The first four entries here have typeof |
| 336 // 'object', whereas JS_FUNCTION_TYPE has typeof 'function'. | 336 // 'object', whereas JS_FUNCTION_TYPE has typeof 'function'. |
| 337 #define INSTANCE_TYPE_LIST(V) \ | 337 #define INSTANCE_TYPE_LIST(V) \ |
| 338 V(STRING_TYPE) \ | 338 V(STRING_TYPE) \ |
| 339 V(ASCII_STRING_TYPE) \ | 339 V(ONE_BYTE_STRING_TYPE) \ |
| 340 V(CONS_STRING_TYPE) \ | 340 V(CONS_STRING_TYPE) \ |
| 341 V(CONS_ASCII_STRING_TYPE) \ | 341 V(CONS_ONE_BYTE_STRING_TYPE) \ |
| 342 V(SLICED_STRING_TYPE) \ | 342 V(SLICED_STRING_TYPE) \ |
| 343 V(SLICED_ASCII_STRING_TYPE) \ | 343 V(SLICED_ONE_BYTE_STRING_TYPE) \ |
| 344 V(EXTERNAL_STRING_TYPE) \ | 344 V(EXTERNAL_STRING_TYPE) \ |
| 345 V(EXTERNAL_ASCII_STRING_TYPE) \ | 345 V(EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
| 346 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 346 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 347 V(SHORT_EXTERNAL_STRING_TYPE) \ | 347 V(SHORT_EXTERNAL_STRING_TYPE) \ |
| 348 V(SHORT_EXTERNAL_ASCII_STRING_TYPE) \ | 348 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE) \ |
| 349 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 349 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 350 \ | 350 \ |
| 351 V(INTERNALIZED_STRING_TYPE) \ | 351 V(INTERNALIZED_STRING_TYPE) \ |
| 352 V(ASCII_INTERNALIZED_STRING_TYPE) \ | 352 V(ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
| 353 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 353 V(EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 354 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ | 354 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
| 355 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 355 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 356 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ | 356 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE) \ |
| 357 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE) \ | 357 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE) \ |
| 358 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ | 358 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE) \ |
| 359 \ | 359 \ |
| 360 V(SYMBOL_TYPE) \ | 360 V(SYMBOL_TYPE) \ |
| 361 \ | 361 \ |
| 362 V(MAP_TYPE) \ | 362 V(MAP_TYPE) \ |
| 363 V(CODE_TYPE) \ | 363 V(CODE_TYPE) \ |
| 364 V(ODDBALL_TYPE) \ | 364 V(ODDBALL_TYPE) \ |
| 365 V(CELL_TYPE) \ | 365 V(CELL_TYPE) \ |
| 366 V(PROPERTY_CELL_TYPE) \ | 366 V(PROPERTY_CELL_TYPE) \ |
| 367 \ | 367 \ |
| 368 V(HEAP_NUMBER_TYPE) \ | 368 V(HEAP_NUMBER_TYPE) \ |
| 369 V(MUTABLE_HEAP_NUMBER_TYPE) \ | 369 V(MUTABLE_HEAP_NUMBER_TYPE) \ |
| 370 V(FOREIGN_TYPE) \ | 370 V(FOREIGN_TYPE) \ |
| 371 V(BYTE_ARRAY_TYPE) \ | 371 V(BYTE_ARRAY_TYPE) \ |
| 372 V(FREE_SPACE_TYPE) \ | 372 V(FREE_SPACE_TYPE) \ |
| 373 /* Note: the order of these external array */ \ | 373 /* Note: the order of these external array */ \ |
| 374 /* types is relied upon in */ \ | 374 /* types is relied upon in */ \ |
| 375 /* Object::IsExternalArray(). */ \ | 375 /* Object::IsExternalArray(). */ \ |
| 376 V(EXTERNAL_INT8_ARRAY_TYPE) \ | 376 V(EXTERNAL_INT8_ARRAY_TYPE) \ |
| 377 V(EXTERNAL_UINT8_ARRAY_TYPE) \ | 377 V(EXTERNAL_UINT8_ARRAY_TYPE) \ |
| 378 V(EXTERNAL_INT16_ARRAY_TYPE) \ | 378 V(EXTERNAL_INT16_ARRAY_TYPE) \ |
| 379 V(EXTERNAL_UINT16_ARRAY_TYPE) \ | 379 V(EXTERNAL_UINT16_ARRAY_TYPE) \ |
| 380 V(EXTERNAL_INT32_ARRAY_TYPE) \ | 380 V(EXTERNAL_INT32_ARRAY_TYPE) \ |
| 381 V(EXTERNAL_UINT32_ARRAY_TYPE) \ | 381 V(EXTERNAL_UINT32_ARRAY_TYPE) \ |
| 382 V(EXTERNAL_FLOAT32_ARRAY_TYPE) \ | 382 V(EXTERNAL_FLOAT32_ARRAY_TYPE) \ |
| 383 V(EXTERNAL_FLOAT64_ARRAY_TYPE) \ | 383 V(EXTERNAL_FLOAT64_ARRAY_TYPE) \ |
| 384 V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \ | 384 V(EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE) \ |
| 385 \ | 385 \ |
| 386 V(FIXED_INT8_ARRAY_TYPE) \ | 386 V(FIXED_INT8_ARRAY_TYPE) \ |
| 387 V(FIXED_UINT8_ARRAY_TYPE) \ | 387 V(FIXED_UINT8_ARRAY_TYPE) \ |
| 388 V(FIXED_INT16_ARRAY_TYPE) \ | 388 V(FIXED_INT16_ARRAY_TYPE) \ |
| 389 V(FIXED_UINT16_ARRAY_TYPE) \ | 389 V(FIXED_UINT16_ARRAY_TYPE) \ |
| 390 V(FIXED_INT32_ARRAY_TYPE) \ | 390 V(FIXED_INT32_ARRAY_TYPE) \ |
| 391 V(FIXED_UINT32_ARRAY_TYPE) \ | 391 V(FIXED_UINT32_ARRAY_TYPE) \ |
| 392 V(FIXED_FLOAT32_ARRAY_TYPE) \ | 392 V(FIXED_FLOAT32_ARRAY_TYPE) \ |
| 393 V(FIXED_FLOAT64_ARRAY_TYPE) \ | 393 V(FIXED_FLOAT64_ARRAY_TYPE) \ |
| 394 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ | 394 V(FIXED_UINT8_CLAMPED_ARRAY_TYPE) \ |
| 395 \ | 395 \ |
| 396 V(FILLER_TYPE) \ | 396 V(FILLER_TYPE) \ |
| 397 \ | 397 \ |
| 398 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \ | 398 V(DECLARED_ACCESSOR_DESCRIPTOR_TYPE) \ |
| 399 V(DECLARED_ACCESSOR_INFO_TYPE) \ | 399 V(DECLARED_ACCESSOR_INFO_TYPE) \ |
| 400 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ | 400 V(EXECUTABLE_ACCESSOR_INFO_TYPE) \ |
| 401 V(ACCESSOR_PAIR_TYPE) \ | 401 V(ACCESSOR_PAIR_TYPE) \ |
| 402 V(ACCESS_CHECK_INFO_TYPE) \ | 402 V(ACCESS_CHECK_INFO_TYPE) \ |
| 403 V(INTERCEPTOR_INFO_TYPE) \ | 403 V(INTERCEPTOR_INFO_TYPE) \ |
| 404 V(CALL_HANDLER_INFO_TYPE) \ | 404 V(CALL_HANDLER_INFO_TYPE) \ |
| 405 V(FUNCTION_TEMPLATE_INFO_TYPE) \ | 405 V(FUNCTION_TEMPLATE_INFO_TYPE) \ |
| 406 V(OBJECT_TEMPLATE_INFO_TYPE) \ | 406 V(OBJECT_TEMPLATE_INFO_TYPE) \ |
| 407 V(SIGNATURE_INFO_TYPE) \ | 407 V(SIGNATURE_INFO_TYPE) \ |
| 408 V(TYPE_SWITCH_INFO_TYPE) \ | 408 V(TYPE_SWITCH_INFO_TYPE) \ |
| 409 V(ALLOCATION_MEMENTO_TYPE) \ | 409 V(ALLOCATION_MEMENTO_TYPE) \ |
| 410 V(ALLOCATION_SITE_TYPE) \ | 410 V(ALLOCATION_SITE_TYPE) \ |
| 411 V(SCRIPT_TYPE) \ | 411 V(SCRIPT_TYPE) \ |
| 412 V(CODE_CACHE_TYPE) \ | 412 V(CODE_CACHE_TYPE) \ |
| 413 V(POLYMORPHIC_CODE_CACHE_TYPE) \ | 413 V(POLYMORPHIC_CODE_CACHE_TYPE) \ |
| 414 V(TYPE_FEEDBACK_INFO_TYPE) \ | 414 V(TYPE_FEEDBACK_INFO_TYPE) \ |
| 415 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ | 415 V(ALIASED_ARGUMENTS_ENTRY_TYPE) \ |
| 416 V(BOX_TYPE) \ | 416 V(BOX_TYPE) \ |
| 417 \ | 417 \ |
| 418 V(FIXED_ARRAY_TYPE) \ | 418 V(FIXED_ARRAY_TYPE) \ |
| 419 V(FIXED_DOUBLE_ARRAY_TYPE) \ | 419 V(FIXED_DOUBLE_ARRAY_TYPE) \ |
| 420 V(CONSTANT_POOL_ARRAY_TYPE) \ | 420 V(CONSTANT_POOL_ARRAY_TYPE) \ |
| 421 V(SHARED_FUNCTION_INFO_TYPE) \ | 421 V(SHARED_FUNCTION_INFO_TYPE) \ |
| 422 \ | 422 \ |
| 423 V(JS_MESSAGE_OBJECT_TYPE) \ | 423 V(JS_MESSAGE_OBJECT_TYPE) \ |
| 424 \ | 424 \ |
| 425 V(JS_VALUE_TYPE) \ | 425 V(JS_VALUE_TYPE) \ |
| 426 V(JS_DATE_TYPE) \ | 426 V(JS_DATE_TYPE) \ |
| 427 V(JS_OBJECT_TYPE) \ | 427 V(JS_OBJECT_TYPE) \ |
| 428 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ | 428 V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \ |
| 429 V(JS_GENERATOR_OBJECT_TYPE) \ | 429 V(JS_GENERATOR_OBJECT_TYPE) \ |
| 430 V(JS_MODULE_TYPE) \ | 430 V(JS_MODULE_TYPE) \ |
| 431 V(JS_GLOBAL_OBJECT_TYPE) \ | 431 V(JS_GLOBAL_OBJECT_TYPE) \ |
| 432 V(JS_BUILTINS_OBJECT_TYPE) \ | 432 V(JS_BUILTINS_OBJECT_TYPE) \ |
| 433 V(JS_GLOBAL_PROXY_TYPE) \ | 433 V(JS_GLOBAL_PROXY_TYPE) \ |
| 434 V(JS_ARRAY_TYPE) \ | 434 V(JS_ARRAY_TYPE) \ |
| 435 V(JS_ARRAY_BUFFER_TYPE) \ | 435 V(JS_ARRAY_BUFFER_TYPE) \ |
| 436 V(JS_TYPED_ARRAY_TYPE) \ | 436 V(JS_TYPED_ARRAY_TYPE) \ |
| 437 V(JS_DATA_VIEW_TYPE) \ | 437 V(JS_DATA_VIEW_TYPE) \ |
| 438 V(JS_PROXY_TYPE) \ | 438 V(JS_PROXY_TYPE) \ |
| 439 V(JS_SET_TYPE) \ | 439 V(JS_SET_TYPE) \ |
| 440 V(JS_MAP_TYPE) \ | 440 V(JS_MAP_TYPE) \ |
| 441 V(JS_SET_ITERATOR_TYPE) \ | 441 V(JS_SET_ITERATOR_TYPE) \ |
| 442 V(JS_MAP_ITERATOR_TYPE) \ | 442 V(JS_MAP_ITERATOR_TYPE) \ |
| 443 V(JS_WEAK_MAP_TYPE) \ | 443 V(JS_WEAK_MAP_TYPE) \ |
| 444 V(JS_WEAK_SET_TYPE) \ | 444 V(JS_WEAK_SET_TYPE) \ |
| 445 V(JS_REGEXP_TYPE) \ | 445 V(JS_REGEXP_TYPE) \ |
| 446 \ | 446 \ |
| 447 V(JS_FUNCTION_TYPE) \ | 447 V(JS_FUNCTION_TYPE) \ |
| 448 V(JS_FUNCTION_PROXY_TYPE) \ | 448 V(JS_FUNCTION_PROXY_TYPE) \ |
| 449 V(DEBUG_INFO_TYPE) \ | 449 V(DEBUG_INFO_TYPE) \ |
| 450 V(BREAK_POINT_INFO_TYPE) | 450 V(BREAK_POINT_INFO_TYPE) |
| 451 | 451 |
| 452 | 452 |
| 453 // Since string types are not consecutive, this macro is used to | 453 // Since string types are not consecutive, this macro is used to |
| 454 // iterate over them. | 454 // iterate over them. |
| 455 #define STRING_TYPE_LIST(V) \ | 455 #define STRING_TYPE_LIST(V) \ |
| 456 V(STRING_TYPE, \ | 456 V(STRING_TYPE, kVariableSizeSentinel, string, String) \ |
| 457 kVariableSizeSentinel, \ | 457 V(ONE_BYTE_STRING_TYPE, kVariableSizeSentinel, one_byte_string, \ |
| 458 string, \ | 458 OneByteString) \ |
| 459 String) \ | 459 V(CONS_STRING_TYPE, ConsString::kSize, cons_string, ConsString) \ |
| 460 V(ASCII_STRING_TYPE, \ | 460 V(CONS_ONE_BYTE_STRING_TYPE, ConsString::kSize, cons_one_byte_string, \ |
| 461 kVariableSizeSentinel, \ | 461 ConsOneByteString) \ |
| 462 ascii_string, \ | 462 V(SLICED_STRING_TYPE, SlicedString::kSize, sliced_string, SlicedString) \ |
| 463 AsciiString) \ | 463 V(SLICED_ONE_BYTE_STRING_TYPE, SlicedString::kSize, sliced_one_byte_string, \ |
| 464 V(CONS_STRING_TYPE, \ | 464 SlicedOneByteString) \ |
| 465 ConsString::kSize, \ | 465 V(EXTERNAL_STRING_TYPE, ExternalTwoByteString::kSize, external_string, \ |
| 466 cons_string, \ | 466 ExternalString) \ |
| 467 ConsString) \ | 467 V(EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kSize, \ |
| 468 V(CONS_ASCII_STRING_TYPE, \ | 468 external_one_byte_string, ExternalOneByteString) \ |
| 469 ConsString::kSize, \ | 469 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, ExternalTwoByteString::kSize, \ |
| 470 cons_ascii_string, \ | 470 external_string_with_one_byte_data, ExternalStringWithOneByteData) \ |
| 471 ConsAsciiString) \ | 471 V(SHORT_EXTERNAL_STRING_TYPE, ExternalTwoByteString::kShortSize, \ |
| 472 V(SLICED_STRING_TYPE, \ | 472 short_external_string, ShortExternalString) \ |
| 473 SlicedString::kSize, \ | 473 V(SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE, ExternalOneByteString::kShortSize, \ |
| 474 sliced_string, \ | 474 short_external_one_byte_string, ShortExternalOneByteString) \ |
| 475 SlicedString) \ | 475 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \ |
| 476 V(SLICED_ASCII_STRING_TYPE, \ | 476 ExternalTwoByteString::kShortSize, \ |
| 477 SlicedString::kSize, \ | 477 short_external_string_with_one_byte_data, \ |
| 478 sliced_ascii_string, \ | 478 ShortExternalStringWithOneByteData) \ |
| 479 SlicedAsciiString) \ | 479 \ |
| 480 V(EXTERNAL_STRING_TYPE, \ | 480 V(INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, internalized_string, \ |
| 481 ExternalTwoByteString::kSize, \ | 481 InternalizedString) \ |
| 482 external_string, \ | 482 V(ONE_BYTE_INTERNALIZED_STRING_TYPE, kVariableSizeSentinel, \ |
| 483 ExternalString) \ | 483 one_byte_internalized_string, OneByteInternalizedString) \ |
| 484 V(EXTERNAL_ASCII_STRING_TYPE, \ | 484 V(EXTERNAL_INTERNALIZED_STRING_TYPE, ExternalTwoByteString::kSize, \ |
| 485 ExternalAsciiString::kSize, \ | 485 external_internalized_string, ExternalInternalizedString) \ |
| 486 external_ascii_string, \ | 486 V(EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, ExternalOneByteString::kSize, \ |
| 487 ExternalAsciiString) \ | 487 external_one_byte_internalized_string, ExternalOneByteInternalizedString) \ |
| 488 V(EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \ | 488 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ |
| 489 ExternalTwoByteString::kSize, \ | 489 ExternalTwoByteString::kSize, \ |
| 490 external_string_with_one_byte_data, \ | 490 external_internalized_string_with_one_byte_data, \ |
| 491 ExternalStringWithOneByteData) \ | 491 ExternalInternalizedStringWithOneByteData) \ |
| 492 V(SHORT_EXTERNAL_STRING_TYPE, \ | 492 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \ |
| 493 ExternalTwoByteString::kShortSize, \ | 493 ExternalTwoByteString::kShortSize, short_external_internalized_string, \ |
| 494 short_external_string, \ | 494 ShortExternalInternalizedString) \ |
| 495 ShortExternalString) \ | 495 V(SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE, \ |
| 496 V(SHORT_EXTERNAL_ASCII_STRING_TYPE, \ | 496 ExternalOneByteString::kShortSize, \ |
| 497 ExternalAsciiString::kShortSize, \ | 497 short_external_one_byte_internalized_string, \ |
| 498 short_external_ascii_string, \ | 498 ShortExternalOneByteInternalizedString) \ |
| 499 ShortExternalAsciiString) \ | 499 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ |
| 500 V(SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE, \ | 500 ExternalTwoByteString::kShortSize, \ |
| 501 ExternalTwoByteString::kShortSize, \ | 501 short_external_internalized_string_with_one_byte_data, \ |
| 502 short_external_string_with_one_byte_data, \ | 502 ShortExternalInternalizedStringWithOneByteData) |
| 503 ShortExternalStringWithOneByteData) \ | |
| 504 \ | |
| 505 V(INTERNALIZED_STRING_TYPE, \ | |
| 506 kVariableSizeSentinel, \ | |
| 507 internalized_string, \ | |
| 508 InternalizedString) \ | |
| 509 V(ASCII_INTERNALIZED_STRING_TYPE, \ | |
| 510 kVariableSizeSentinel, \ | |
| 511 ascii_internalized_string, \ | |
| 512 AsciiInternalizedString) \ | |
| 513 V(EXTERNAL_INTERNALIZED_STRING_TYPE, \ | |
| 514 ExternalTwoByteString::kSize, \ | |
| 515 external_internalized_string, \ | |
| 516 ExternalInternalizedString) \ | |
| 517 V(EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE, \ | |
| 518 ExternalAsciiString::kSize, \ | |
| 519 external_ascii_internalized_string, \ | |
| 520 ExternalAsciiInternalizedString) \ | |
| 521 V(EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ | |
| 522 ExternalTwoByteString::kSize, \ | |
| 523 external_internalized_string_with_one_byte_data, \ | |
| 524 ExternalInternalizedStringWithOneByteData) \ | |
| 525 V(SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE, \ | |
| 526 ExternalTwoByteString::kShortSize, \ | |
| 527 short_external_internalized_string, \ | |
| 528 ShortExternalInternalizedString) \ | |
| 529 V(SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE, \ | |
| 530 ExternalAsciiString::kShortSize, \ | |
| 531 short_external_ascii_internalized_string, \ | |
| 532 ShortExternalAsciiInternalizedString) \ | |
| 533 V(SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE, \ | |
| 534 ExternalTwoByteString::kShortSize, \ | |
| 535 short_external_internalized_string_with_one_byte_data, \ | |
| 536 ShortExternalInternalizedStringWithOneByteData) \ | |
| 537 | 503 |
| 538 // A struct is a simple object a set of object-valued fields. Including an | 504 // A struct is a simple object a set of object-valued fields. Including an |
| 539 // object type in this causes the compiler to generate most of the boilerplate | 505 // object type in this causes the compiler to generate most of the boilerplate |
| 540 // code for the class including allocation and garbage collection routines, | 506 // code for the class including allocation and garbage collection routines, |
| 541 // casts and predicates. All you need to define is the class, methods and | 507 // casts and predicates. All you need to define is the class, methods and |
| 542 // object verification routines. Easy, no? | 508 // object verification routines. Easy, no? |
| 543 // | 509 // |
| 544 // Note that for subtle reasons related to the ordering or numerical values of | 510 // Note that for subtle reasons related to the ordering or numerical values of |
| 545 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST | 511 // type tags, elements in this list have to be added to the INSTANCE_TYPE_LIST |
| 546 // manually. | 512 // manually. |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 kStringRepresentationMask; | 600 kStringRepresentationMask; |
| 635 const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag; | 601 const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag; |
| 636 | 602 |
| 637 static inline bool IsShortcutCandidate(int type) { | 603 static inline bool IsShortcutCandidate(int type) { |
| 638 return ((type & kShortcutTypeMask) == kShortcutTypeTag); | 604 return ((type & kShortcutTypeMask) == kShortcutTypeTag); |
| 639 } | 605 } |
| 640 | 606 |
| 641 | 607 |
| 642 enum InstanceType { | 608 enum InstanceType { |
| 643 // String types. | 609 // String types. |
| 644 INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag | 610 INTERNALIZED_STRING_TYPE = |
| 645 | kInternalizedTag, | 611 kTwoByteStringTag | kSeqStringTag | kInternalizedTag, |
| 646 ASCII_INTERNALIZED_STRING_TYPE = kOneByteStringTag | kSeqStringTag | 612 ONE_BYTE_INTERNALIZED_STRING_TYPE = |
| 647 | kInternalizedTag, | 613 kOneByteStringTag | kSeqStringTag | kInternalizedTag, |
| 648 EXTERNAL_INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kExternalStringTag | 614 EXTERNAL_INTERNALIZED_STRING_TYPE = |
| 649 | kInternalizedTag, | 615 kTwoByteStringTag | kExternalStringTag | kInternalizedTag, |
| 650 EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = kOneByteStringTag | 616 EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE = |
| 651 | kExternalStringTag | kInternalizedTag, | 617 kOneByteStringTag | kExternalStringTag | kInternalizedTag, |
| 652 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = | 618 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = |
| 653 EXTERNAL_INTERNALIZED_STRING_TYPE | kOneByteDataHintTag | 619 EXTERNAL_INTERNALIZED_STRING_TYPE | kOneByteDataHintTag | |
| 654 | kInternalizedTag, | 620 kInternalizedTag, |
| 655 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE = | 621 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE = EXTERNAL_INTERNALIZED_STRING_TYPE | |
| 656 EXTERNAL_INTERNALIZED_STRING_TYPE | kShortExternalStringTag | 622 kShortExternalStringTag | |
| 657 | kInternalizedTag, | 623 kInternalizedTag, |
| 658 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE = | 624 SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE = |
| 659 EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kShortExternalStringTag | 625 EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kShortExternalStringTag | |
| 660 | kInternalizedTag, | 626 kInternalizedTag, |
| 661 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = | 627 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE = |
| 662 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | 628 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | |
| 663 | kShortExternalStringTag | kInternalizedTag, | 629 kShortExternalStringTag | kInternalizedTag, |
| 664 | |
| 665 STRING_TYPE = INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 630 STRING_TYPE = INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 666 ASCII_STRING_TYPE = ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 631 ONE_BYTE_STRING_TYPE = |
| 632 ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 667 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag | kNotInternalizedTag, | 633 CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag | kNotInternalizedTag, |
| 668 CONS_ASCII_STRING_TYPE = | 634 CONS_ONE_BYTE_STRING_TYPE = |
| 669 kOneByteStringTag | kConsStringTag | kNotInternalizedTag, | 635 kOneByteStringTag | kConsStringTag | kNotInternalizedTag, |
| 670 | |
| 671 SLICED_STRING_TYPE = | 636 SLICED_STRING_TYPE = |
| 672 kTwoByteStringTag | kSlicedStringTag | kNotInternalizedTag, | 637 kTwoByteStringTag | kSlicedStringTag | kNotInternalizedTag, |
| 673 SLICED_ASCII_STRING_TYPE = | 638 SLICED_ONE_BYTE_STRING_TYPE = |
| 674 kOneByteStringTag | kSlicedStringTag | kNotInternalizedTag, | 639 kOneByteStringTag | kSlicedStringTag | kNotInternalizedTag, |
| 675 EXTERNAL_STRING_TYPE = | 640 EXTERNAL_STRING_TYPE = |
| 676 EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 641 EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 677 EXTERNAL_ASCII_STRING_TYPE = | 642 EXTERNAL_ONE_BYTE_STRING_TYPE = |
| 678 EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 643 EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 679 EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = | 644 EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = |
| 680 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | 645 EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | |
| 681 | kNotInternalizedTag, | 646 kNotInternalizedTag, |
| 682 SHORT_EXTERNAL_STRING_TYPE = | 647 SHORT_EXTERNAL_STRING_TYPE = |
| 683 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 648 SHORT_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 684 SHORT_EXTERNAL_ASCII_STRING_TYPE = | 649 SHORT_EXTERNAL_ONE_BYTE_STRING_TYPE = |
| 685 SHORT_EXTERNAL_ASCII_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, | 650 SHORT_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag, |
| 686 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = | 651 SHORT_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE = |
| 687 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | 652 SHORT_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE | |
| 688 | kNotInternalizedTag, | 653 kNotInternalizedTag, |
| 689 | 654 |
| 690 // Non-string names | 655 // Non-string names |
| 691 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE | 656 SYMBOL_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE |
| 692 | 657 |
| 693 // Objects allocated in their own spaces (never in new space). | 658 // Objects allocated in their own spaces (never in new space). |
| 694 MAP_TYPE, | 659 MAP_TYPE, |
| 695 CODE_TYPE, | 660 CODE_TYPE, |
| 696 ODDBALL_TYPE, | 661 ODDBALL_TYPE, |
| 697 CELL_TYPE, | 662 CELL_TYPE, |
| 698 PROPERTY_CELL_TYPE, | 663 PROPERTY_CELL_TYPE, |
| 699 | 664 |
| 700 // "Data", objects that cannot contain non-map-word pointers to heap | 665 // "Data", objects that cannot contain non-map-word pointers to heap |
| 701 // objects. | 666 // objects. |
| 702 HEAP_NUMBER_TYPE, | 667 HEAP_NUMBER_TYPE, |
| 703 MUTABLE_HEAP_NUMBER_TYPE, | 668 MUTABLE_HEAP_NUMBER_TYPE, |
| 704 FOREIGN_TYPE, | 669 FOREIGN_TYPE, |
| 705 BYTE_ARRAY_TYPE, | 670 BYTE_ARRAY_TYPE, |
| 706 FREE_SPACE_TYPE, | 671 FREE_SPACE_TYPE, |
| 707 | |
| 708 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE | 672 EXTERNAL_INT8_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE |
| 709 EXTERNAL_UINT8_ARRAY_TYPE, | 673 EXTERNAL_UINT8_ARRAY_TYPE, |
| 710 EXTERNAL_INT16_ARRAY_TYPE, | 674 EXTERNAL_INT16_ARRAY_TYPE, |
| 711 EXTERNAL_UINT16_ARRAY_TYPE, | 675 EXTERNAL_UINT16_ARRAY_TYPE, |
| 712 EXTERNAL_INT32_ARRAY_TYPE, | 676 EXTERNAL_INT32_ARRAY_TYPE, |
| 713 EXTERNAL_UINT32_ARRAY_TYPE, | 677 EXTERNAL_UINT32_ARRAY_TYPE, |
| 714 EXTERNAL_FLOAT32_ARRAY_TYPE, | 678 EXTERNAL_FLOAT32_ARRAY_TYPE, |
| 715 EXTERNAL_FLOAT64_ARRAY_TYPE, | 679 EXTERNAL_FLOAT64_ARRAY_TYPE, |
| 716 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE | 680 EXTERNAL_UINT8_CLAMPED_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE |
| 717 | 681 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE |
| 718 FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE | |
| 719 FIXED_UINT8_ARRAY_TYPE, | 682 FIXED_UINT8_ARRAY_TYPE, |
| 720 FIXED_INT16_ARRAY_TYPE, | 683 FIXED_INT16_ARRAY_TYPE, |
| 721 FIXED_UINT16_ARRAY_TYPE, | 684 FIXED_UINT16_ARRAY_TYPE, |
| 722 FIXED_INT32_ARRAY_TYPE, | 685 FIXED_INT32_ARRAY_TYPE, |
| 723 FIXED_UINT32_ARRAY_TYPE, | 686 FIXED_UINT32_ARRAY_TYPE, |
| 724 FIXED_FLOAT32_ARRAY_TYPE, | 687 FIXED_FLOAT32_ARRAY_TYPE, |
| 725 FIXED_FLOAT64_ARRAY_TYPE, | 688 FIXED_FLOAT64_ARRAY_TYPE, |
| 726 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE | 689 FIXED_UINT8_CLAMPED_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE |
| 727 | |
| 728 FIXED_DOUBLE_ARRAY_TYPE, | 690 FIXED_DOUBLE_ARRAY_TYPE, |
| 729 FILLER_TYPE, // LAST_DATA_TYPE | 691 FILLER_TYPE, // LAST_DATA_TYPE |
| 730 | 692 |
| 731 // Structs. | 693 // Structs. |
| 732 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, | 694 DECLARED_ACCESSOR_DESCRIPTOR_TYPE, |
| 733 DECLARED_ACCESSOR_INFO_TYPE, | 695 DECLARED_ACCESSOR_INFO_TYPE, |
| 734 EXECUTABLE_ACCESSOR_INFO_TYPE, | 696 EXECUTABLE_ACCESSOR_INFO_TYPE, |
| 735 ACCESSOR_PAIR_TYPE, | 697 ACCESSOR_PAIR_TYPE, |
| 736 ACCESS_CHECK_INFO_TYPE, | 698 ACCESS_CHECK_INFO_TYPE, |
| 737 INTERCEPTOR_INFO_TYPE, | 699 INTERCEPTOR_INFO_TYPE, |
| 738 CALL_HANDLER_INFO_TYPE, | 700 CALL_HANDLER_INFO_TYPE, |
| 739 FUNCTION_TEMPLATE_INFO_TYPE, | 701 FUNCTION_TEMPLATE_INFO_TYPE, |
| 740 OBJECT_TEMPLATE_INFO_TYPE, | 702 OBJECT_TEMPLATE_INFO_TYPE, |
| 741 SIGNATURE_INFO_TYPE, | 703 SIGNATURE_INFO_TYPE, |
| 742 TYPE_SWITCH_INFO_TYPE, | 704 TYPE_SWITCH_INFO_TYPE, |
| 743 ALLOCATION_SITE_TYPE, | 705 ALLOCATION_SITE_TYPE, |
| 744 ALLOCATION_MEMENTO_TYPE, | 706 ALLOCATION_MEMENTO_TYPE, |
| 745 SCRIPT_TYPE, | 707 SCRIPT_TYPE, |
| 746 CODE_CACHE_TYPE, | 708 CODE_CACHE_TYPE, |
| 747 POLYMORPHIC_CODE_CACHE_TYPE, | 709 POLYMORPHIC_CODE_CACHE_TYPE, |
| 748 TYPE_FEEDBACK_INFO_TYPE, | 710 TYPE_FEEDBACK_INFO_TYPE, |
| 749 ALIASED_ARGUMENTS_ENTRY_TYPE, | 711 ALIASED_ARGUMENTS_ENTRY_TYPE, |
| 750 BOX_TYPE, | 712 BOX_TYPE, |
| 751 DEBUG_INFO_TYPE, | 713 DEBUG_INFO_TYPE, |
| 752 BREAK_POINT_INFO_TYPE, | 714 BREAK_POINT_INFO_TYPE, |
| 753 | |
| 754 FIXED_ARRAY_TYPE, | 715 FIXED_ARRAY_TYPE, |
| 755 CONSTANT_POOL_ARRAY_TYPE, | 716 CONSTANT_POOL_ARRAY_TYPE, |
| 756 SHARED_FUNCTION_INFO_TYPE, | 717 SHARED_FUNCTION_INFO_TYPE, |
| 757 | 718 |
| 758 // All the following types are subtypes of JSReceiver, which corresponds to | 719 // All the following types are subtypes of JSReceiver, which corresponds to |
| 759 // objects in the JS sense. The first and the last type in this range are | 720 // objects in the JS sense. The first and the last type in this range are |
| 760 // the two forms of function. This organization enables using the same | 721 // the two forms of function. This organization enables using the same |
| 761 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the | 722 // compares for checking the JS_RECEIVER/SPEC_OBJECT range and the |
| 762 // NONCALLABLE_JS_OBJECT range. | 723 // NONCALLABLE_JS_OBJECT range. |
| 763 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE | 724 JS_FUNCTION_PROXY_TYPE, // FIRST_JS_RECEIVER_TYPE, FIRST_JS_PROXY_TYPE |
| 764 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE | 725 JS_PROXY_TYPE, // LAST_JS_PROXY_TYPE |
| 765 | 726 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE |
| 766 JS_VALUE_TYPE, // FIRST_JS_OBJECT_TYPE | |
| 767 JS_MESSAGE_OBJECT_TYPE, | 727 JS_MESSAGE_OBJECT_TYPE, |
| 768 JS_DATE_TYPE, | 728 JS_DATE_TYPE, |
| 769 JS_OBJECT_TYPE, | 729 JS_OBJECT_TYPE, |
| 770 JS_CONTEXT_EXTENSION_OBJECT_TYPE, | 730 JS_CONTEXT_EXTENSION_OBJECT_TYPE, |
| 771 JS_GENERATOR_OBJECT_TYPE, | 731 JS_GENERATOR_OBJECT_TYPE, |
| 772 JS_MODULE_TYPE, | 732 JS_MODULE_TYPE, |
| 773 JS_GLOBAL_OBJECT_TYPE, | 733 JS_GLOBAL_OBJECT_TYPE, |
| 774 JS_BUILTINS_OBJECT_TYPE, | 734 JS_BUILTINS_OBJECT_TYPE, |
| 775 JS_GLOBAL_PROXY_TYPE, | 735 JS_GLOBAL_PROXY_TYPE, |
| 776 JS_ARRAY_TYPE, | 736 JS_ARRAY_TYPE, |
| 777 JS_ARRAY_BUFFER_TYPE, | 737 JS_ARRAY_BUFFER_TYPE, |
| 778 JS_TYPED_ARRAY_TYPE, | 738 JS_TYPED_ARRAY_TYPE, |
| 779 JS_DATA_VIEW_TYPE, | 739 JS_DATA_VIEW_TYPE, |
| 780 JS_SET_TYPE, | 740 JS_SET_TYPE, |
| 781 JS_MAP_TYPE, | 741 JS_MAP_TYPE, |
| 782 JS_SET_ITERATOR_TYPE, | 742 JS_SET_ITERATOR_TYPE, |
| 783 JS_MAP_ITERATOR_TYPE, | 743 JS_MAP_ITERATOR_TYPE, |
| 784 JS_WEAK_MAP_TYPE, | 744 JS_WEAK_MAP_TYPE, |
| 785 JS_WEAK_SET_TYPE, | 745 JS_WEAK_SET_TYPE, |
| 786 | |
| 787 JS_REGEXP_TYPE, | 746 JS_REGEXP_TYPE, |
| 788 | |
| 789 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE | 747 JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE |
| 790 | 748 |
| 791 // Pseudo-types | 749 // Pseudo-types |
| 792 FIRST_TYPE = 0x0, | 750 FIRST_TYPE = 0x0, |
| 793 LAST_TYPE = JS_FUNCTION_TYPE, | 751 LAST_TYPE = JS_FUNCTION_TYPE, |
| 794 FIRST_NAME_TYPE = FIRST_TYPE, | 752 FIRST_NAME_TYPE = FIRST_TYPE, |
| 795 LAST_NAME_TYPE = SYMBOL_TYPE, | 753 LAST_NAME_TYPE = SYMBOL_TYPE, |
| 796 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, | 754 FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE, |
| 797 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, | 755 LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE, |
| 798 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, | 756 FIRST_NONSTRING_TYPE = SYMBOL_TYPE, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 #define DECLARE_VERIFIER(Name) | 865 #define DECLARE_VERIFIER(Name) |
| 908 #endif | 866 #endif |
| 909 | 867 |
| 910 #ifdef OBJECT_PRINT | 868 #ifdef OBJECT_PRINT |
| 911 #define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT | 869 #define DECLARE_PRINTER(Name) void Name##Print(OStream& os); // NOLINT |
| 912 #else | 870 #else |
| 913 #define DECLARE_PRINTER(Name) | 871 #define DECLARE_PRINTER(Name) |
| 914 #endif | 872 #endif |
| 915 | 873 |
| 916 | 874 |
| 917 #define OBJECT_TYPE_LIST(V) \ | 875 #define OBJECT_TYPE_LIST(V) \ |
| 918 V(Smi) \ | 876 V(Smi) \ |
| 919 V(HeapObject) \ | 877 V(HeapObject) \ |
| 920 V(Number) \ | 878 V(Number) |
| 921 | 879 |
| 922 #define HEAP_OBJECT_TYPE_LIST(V) \ | 880 #define HEAP_OBJECT_TYPE_LIST(V) \ |
| 923 V(HeapNumber) \ | 881 V(HeapNumber) \ |
| 924 V(MutableHeapNumber) \ | 882 V(MutableHeapNumber) \ |
| 925 V(Name) \ | 883 V(Name) \ |
| 926 V(UniqueName) \ | 884 V(UniqueName) \ |
| 927 V(String) \ | 885 V(String) \ |
| 928 V(SeqString) \ | 886 V(SeqString) \ |
| 929 V(ExternalString) \ | 887 V(ExternalString) \ |
| 930 V(ConsString) \ | 888 V(ConsString) \ |
| 931 V(SlicedString) \ | 889 V(SlicedString) \ |
| 932 V(ExternalTwoByteString) \ | 890 V(ExternalTwoByteString) \ |
| 933 V(ExternalAsciiString) \ | 891 V(ExternalOneByteString) \ |
| 934 V(SeqTwoByteString) \ | 892 V(SeqTwoByteString) \ |
| 935 V(SeqOneByteString) \ | 893 V(SeqOneByteString) \ |
| 936 V(InternalizedString) \ | 894 V(InternalizedString) \ |
| 937 V(Symbol) \ | 895 V(Symbol) \ |
| 938 \ | 896 \ |
| 939 V(ExternalArray) \ | 897 V(ExternalArray) \ |
| 940 V(ExternalInt8Array) \ | 898 V(ExternalInt8Array) \ |
| 941 V(ExternalUint8Array) \ | 899 V(ExternalUint8Array) \ |
| 942 V(ExternalInt16Array) \ | 900 V(ExternalInt16Array) \ |
| 943 V(ExternalUint16Array) \ | 901 V(ExternalUint16Array) \ |
| 944 V(ExternalInt32Array) \ | 902 V(ExternalInt32Array) \ |
| 945 V(ExternalUint32Array) \ | 903 V(ExternalUint32Array) \ |
| 946 V(ExternalFloat32Array) \ | 904 V(ExternalFloat32Array) \ |
| 947 V(ExternalFloat64Array) \ | 905 V(ExternalFloat64Array) \ |
| 948 V(ExternalUint8ClampedArray) \ | 906 V(ExternalUint8ClampedArray) \ |
| 949 V(FixedTypedArrayBase) \ | 907 V(FixedTypedArrayBase) \ |
| 950 V(FixedUint8Array) \ | 908 V(FixedUint8Array) \ |
| 951 V(FixedInt8Array) \ | 909 V(FixedInt8Array) \ |
| 952 V(FixedUint16Array) \ | 910 V(FixedUint16Array) \ |
| 953 V(FixedInt16Array) \ | 911 V(FixedInt16Array) \ |
| 954 V(FixedUint32Array) \ | 912 V(FixedUint32Array) \ |
| 955 V(FixedInt32Array) \ | 913 V(FixedInt32Array) \ |
| 956 V(FixedFloat32Array) \ | 914 V(FixedFloat32Array) \ |
| 957 V(FixedFloat64Array) \ | 915 V(FixedFloat64Array) \ |
| 958 V(FixedUint8ClampedArray) \ | 916 V(FixedUint8ClampedArray) \ |
| 959 V(ByteArray) \ | 917 V(ByteArray) \ |
| 960 V(FreeSpace) \ | 918 V(FreeSpace) \ |
| 961 V(JSReceiver) \ | 919 V(JSReceiver) \ |
| 962 V(JSObject) \ | 920 V(JSObject) \ |
| 963 V(JSContextExtensionObject) \ | 921 V(JSContextExtensionObject) \ |
| 964 V(JSGeneratorObject) \ | 922 V(JSGeneratorObject) \ |
| 965 V(JSModule) \ | 923 V(JSModule) \ |
| 966 V(Map) \ | 924 V(Map) \ |
| 967 V(DescriptorArray) \ | 925 V(DescriptorArray) \ |
| 968 V(TransitionArray) \ | 926 V(TransitionArray) \ |
| 969 V(DeoptimizationInputData) \ | 927 V(DeoptimizationInputData) \ |
| 970 V(DeoptimizationOutputData) \ | 928 V(DeoptimizationOutputData) \ |
| 971 V(DependentCode) \ | 929 V(DependentCode) \ |
| 972 V(FixedArray) \ | 930 V(FixedArray) \ |
| 973 V(FixedDoubleArray) \ | 931 V(FixedDoubleArray) \ |
| 974 V(ConstantPoolArray) \ | 932 V(ConstantPoolArray) \ |
| 975 V(Context) \ | 933 V(Context) \ |
| 976 V(NativeContext) \ | 934 V(NativeContext) \ |
| 977 V(ScopeInfo) \ | 935 V(ScopeInfo) \ |
| 978 V(JSFunction) \ | 936 V(JSFunction) \ |
| 979 V(Code) \ | 937 V(Code) \ |
| 980 V(Oddball) \ | 938 V(Oddball) \ |
| 981 V(SharedFunctionInfo) \ | 939 V(SharedFunctionInfo) \ |
| 982 V(JSValue) \ | 940 V(JSValue) \ |
| 983 V(JSDate) \ | 941 V(JSDate) \ |
| 984 V(JSMessageObject) \ | 942 V(JSMessageObject) \ |
| 985 V(StringWrapper) \ | 943 V(StringWrapper) \ |
| 986 V(Foreign) \ | 944 V(Foreign) \ |
| 987 V(Boolean) \ | 945 V(Boolean) \ |
| 988 V(JSArray) \ | 946 V(JSArray) \ |
| 989 V(JSArrayBuffer) \ | 947 V(JSArrayBuffer) \ |
| 990 V(JSArrayBufferView) \ | 948 V(JSArrayBufferView) \ |
| 991 V(JSTypedArray) \ | 949 V(JSTypedArray) \ |
| 992 V(JSDataView) \ | 950 V(JSDataView) \ |
| 993 V(JSProxy) \ | 951 V(JSProxy) \ |
| 994 V(JSFunctionProxy) \ | 952 V(JSFunctionProxy) \ |
| 995 V(JSSet) \ | 953 V(JSSet) \ |
| 996 V(JSMap) \ | 954 V(JSMap) \ |
| 997 V(JSSetIterator) \ | 955 V(JSSetIterator) \ |
| 998 V(JSMapIterator) \ | 956 V(JSMapIterator) \ |
| 999 V(JSWeakCollection) \ | 957 V(JSWeakCollection) \ |
| 1000 V(JSWeakMap) \ | 958 V(JSWeakMap) \ |
| 1001 V(JSWeakSet) \ | 959 V(JSWeakSet) \ |
| 1002 V(JSRegExp) \ | 960 V(JSRegExp) \ |
| 1003 V(HashTable) \ | 961 V(HashTable) \ |
| 1004 V(Dictionary) \ | 962 V(Dictionary) \ |
| 1005 V(StringTable) \ | 963 V(StringTable) \ |
| 1006 V(JSFunctionResultCache) \ | 964 V(JSFunctionResultCache) \ |
| 1007 V(NormalizedMapCache) \ | 965 V(NormalizedMapCache) \ |
| 1008 V(CompilationCacheTable) \ | 966 V(CompilationCacheTable) \ |
| 1009 V(CodeCacheHashTable) \ | 967 V(CodeCacheHashTable) \ |
| 1010 V(PolymorphicCodeCacheHashTable) \ | 968 V(PolymorphicCodeCacheHashTable) \ |
| 1011 V(MapCache) \ | 969 V(MapCache) \ |
| 1012 V(Primitive) \ | 970 V(Primitive) \ |
| 1013 V(GlobalObject) \ | 971 V(GlobalObject) \ |
| 1014 V(JSGlobalObject) \ | 972 V(JSGlobalObject) \ |
| 1015 V(JSBuiltinsObject) \ | 973 V(JSBuiltinsObject) \ |
| 1016 V(JSGlobalProxy) \ | 974 V(JSGlobalProxy) \ |
| 1017 V(UndetectableObject) \ | 975 V(UndetectableObject) \ |
| 1018 V(AccessCheckNeeded) \ | 976 V(AccessCheckNeeded) \ |
| 1019 V(Cell) \ | 977 V(Cell) \ |
| 1020 V(PropertyCell) \ | 978 V(PropertyCell) \ |
| 1021 V(ObjectHashTable) \ | 979 V(ObjectHashTable) \ |
| 1022 V(WeakHashTable) \ | 980 V(WeakHashTable) \ |
| 1023 V(OrderedHashTable) | 981 V(OrderedHashTable) |
| 1024 | 982 |
| 1025 | 983 |
| 1026 #define ERROR_MESSAGES_LIST(V) \ | 984 #define ERROR_MESSAGES_LIST(V) \ |
| 1027 V(kNoReason, "no reason") \ | 985 V(kNoReason, "no reason") \ |
| 1028 \ | 986 \ |
| 1029 V(k32BitValueInRegisterIsNotZeroExtended, \ | 987 V(k32BitValueInRegisterIsNotZeroExtended, \ |
| 1030 "32 bit value in register is not zero-extended") \ | 988 "32 bit value in register is not zero-extended") \ |
| 1031 V(kAlignmentMarkerExpected, "Alignment marker expected") \ | 989 V(kAlignmentMarkerExpected, "Alignment marker expected") \ |
| 1032 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ | 990 V(kAllocationIsNotDoubleAligned, "Allocation is not double aligned") \ |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1121 V(kGlobalFunctionsMustHaveInitialMap, \ | 1079 V(kGlobalFunctionsMustHaveInitialMap, \ |
| 1122 "Global functions must have initial map") \ | 1080 "Global functions must have initial map") \ |
| 1123 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \ | 1081 V(kHeapNumberMapRegisterClobbered, "HeapNumberMap register clobbered") \ |
| 1124 V(kHydrogenFilter, "Optimization disabled by filter") \ | 1082 V(kHydrogenFilter, "Optimization disabled by filter") \ |
| 1125 V(kImportDeclaration, "Import declaration") \ | 1083 V(kImportDeclaration, "Import declaration") \ |
| 1126 V(kImproperObjectOnPrototypeChainForStore, \ | 1084 V(kImproperObjectOnPrototypeChainForStore, \ |
| 1127 "Improper object on prototype chain for store") \ | 1085 "Improper object on prototype chain for store") \ |
| 1128 V(kIndexIsNegative, "Index is negative") \ | 1086 V(kIndexIsNegative, "Index is negative") \ |
| 1129 V(kIndexIsTooLarge, "Index is too large") \ | 1087 V(kIndexIsTooLarge, "Index is too large") \ |
| 1130 V(kInlinedRuntimeFunctionClassOf, "Inlined runtime function: ClassOf") \ | 1088 V(kInlinedRuntimeFunctionClassOf, "Inlined runtime function: ClassOf") \ |
| 1131 V(kInlinedRuntimeFunctionFastAsciiArrayJoin, \ | 1089 V(kInlinedRuntimeFunctionFastOneByteArrayJoin, \ |
| 1132 "Inlined runtime function: FastAsciiArrayJoin") \ | 1090 "Inlined runtime function: FastOneByteArrayJoin") \ |
| 1133 V(kInlinedRuntimeFunctionGeneratorNext, \ | 1091 V(kInlinedRuntimeFunctionGeneratorNext, \ |
| 1134 "Inlined runtime function: GeneratorNext") \ | 1092 "Inlined runtime function: GeneratorNext") \ |
| 1135 V(kInlinedRuntimeFunctionGeneratorThrow, \ | 1093 V(kInlinedRuntimeFunctionGeneratorThrow, \ |
| 1136 "Inlined runtime function: GeneratorThrow") \ | 1094 "Inlined runtime function: GeneratorThrow") \ |
| 1137 V(kInlinedRuntimeFunctionGetFromCache, \ | 1095 V(kInlinedRuntimeFunctionGetFromCache, \ |
| 1138 "Inlined runtime function: GetFromCache") \ | 1096 "Inlined runtime function: GetFromCache") \ |
| 1139 V(kInlinedRuntimeFunctionIsNonNegativeSmi, \ | 1097 V(kInlinedRuntimeFunctionIsNonNegativeSmi, \ |
| 1140 "Inlined runtime function: IsNonNegativeSmi") \ | 1098 "Inlined runtime function: IsNonNegativeSmi") \ |
| 1141 V(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf, \ | 1099 V(kInlinedRuntimeFunctionIsStringWrapperSafeForDefaultValueOf, \ |
| 1142 "Inlined runtime function: IsStringWrapperSafeForDefaultValueOf") \ | 1100 "Inlined runtime function: IsStringWrapperSafeForDefaultValueOf") \ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 V(kModuleDeclaration, "Module declaration") \ | 1138 V(kModuleDeclaration, "Module declaration") \ |
| 1181 V(kModuleLiteral, "Module literal") \ | 1139 V(kModuleLiteral, "Module literal") \ |
| 1182 V(kModulePath, "Module path") \ | 1140 V(kModulePath, "Module path") \ |
| 1183 V(kModuleStatement, "Module statement") \ | 1141 V(kModuleStatement, "Module statement") \ |
| 1184 V(kModuleVariable, "Module variable") \ | 1142 V(kModuleVariable, "Module variable") \ |
| 1185 V(kModuleUrl, "Module url") \ | 1143 V(kModuleUrl, "Module url") \ |
| 1186 V(kNativeFunctionLiteral, "Native function literal") \ | 1144 V(kNativeFunctionLiteral, "Native function literal") \ |
| 1187 V(kSuperReference, "Super reference") \ | 1145 V(kSuperReference, "Super reference") \ |
| 1188 V(kNeedSmiLiteral, "Need a Smi literal here") \ | 1146 V(kNeedSmiLiteral, "Need a Smi literal here") \ |
| 1189 V(kNoCasesLeft, "No cases left") \ | 1147 V(kNoCasesLeft, "No cases left") \ |
| 1190 V(kNoEmptyArraysHereInEmitFastAsciiArrayJoin, \ | 1148 V(kNoEmptyArraysHereInEmitFastOneByteArrayJoin, \ |
| 1191 "No empty arrays here in EmitFastAsciiArrayJoin") \ | 1149 "No empty arrays here in EmitFastOneByteArrayJoin") \ |
| 1192 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \ | 1150 V(kNonInitializerAssignmentToConst, "Non-initializer assignment to const") \ |
| 1193 V(kNonSmiIndex, "Non-smi index") \ | 1151 V(kNonSmiIndex, "Non-smi index") \ |
| 1194 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \ | 1152 V(kNonSmiKeyInArrayLiteral, "Non-smi key in array literal") \ |
| 1195 V(kNonSmiValue, "Non-smi value") \ | 1153 V(kNonSmiValue, "Non-smi value") \ |
| 1196 V(kNonObject, "Non-object value") \ | 1154 V(kNonObject, "Non-object value") \ |
| 1197 V(kNotEnoughVirtualRegistersForValues, \ | 1155 V(kNotEnoughVirtualRegistersForValues, \ |
| 1198 "Not enough virtual registers for values") \ | 1156 "Not enough virtual registers for values") \ |
| 1199 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \ | 1157 V(kNotEnoughSpillSlotsForOsr, "Not enough spill slots for OSR") \ |
| 1200 V(kNotEnoughVirtualRegistersRegalloc, \ | 1158 V(kNotEnoughVirtualRegistersRegalloc, \ |
| 1201 "Not enough virtual registers (regalloc)") \ | 1159 "Not enough virtual registers (regalloc)") \ |
| (...skipping 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3795 Isolate* isolate, | 3753 Isolate* isolate, |
| 3796 Handle<String> str); | 3754 Handle<String> str); |
| 3797 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists( | 3755 MUST_USE_RESULT static MaybeHandle<String> LookupTwoCharsStringIfExists( |
| 3798 Isolate* isolate, | 3756 Isolate* isolate, |
| 3799 uint16_t c1, | 3757 uint16_t c1, |
| 3800 uint16_t c2); | 3758 uint16_t c2); |
| 3801 | 3759 |
| 3802 DECLARE_CAST(StringTable) | 3760 DECLARE_CAST(StringTable) |
| 3803 | 3761 |
| 3804 private: | 3762 private: |
| 3805 template <bool seq_ascii> friend class JsonParser; | 3763 template <bool seq_one_byte> |
| 3764 friend class JsonParser; |
| 3806 | 3765 |
| 3807 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); | 3766 DISALLOW_IMPLICIT_CONSTRUCTORS(StringTable); |
| 3808 }; | 3767 }; |
| 3809 | 3768 |
| 3810 | 3769 |
| 3811 class MapCacheShape : public BaseShape<HashTableKey*> { | 3770 class MapCacheShape : public BaseShape<HashTableKey*> { |
| 3812 public: | 3771 public: |
| 3813 static inline bool IsMatch(HashTableKey* key, Object* value) { | 3772 static inline bool IsMatch(HashTableKey* key, Object* value) { |
| 3814 return key->IsMatch(value); | 3773 return key->IsMatch(value); |
| 3815 } | 3774 } |
| (...skipping 4226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8042 // Regular expressions | 8001 // Regular expressions |
| 8043 // The regular expression holds a single reference to a FixedArray in | 8002 // The regular expression holds a single reference to a FixedArray in |
| 8044 // the kDataOffset field. | 8003 // the kDataOffset field. |
| 8045 // The FixedArray contains the following data: | 8004 // The FixedArray contains the following data: |
| 8046 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) | 8005 // - tag : type of regexp implementation (not compiled yet, atom or irregexp) |
| 8047 // - reference to the original source string | 8006 // - reference to the original source string |
| 8048 // - reference to the original flag string | 8007 // - reference to the original flag string |
| 8049 // If it is an atom regexp | 8008 // If it is an atom regexp |
| 8050 // - a reference to a literal string to search for | 8009 // - a reference to a literal string to search for |
| 8051 // If it is an irregexp regexp: | 8010 // If it is an irregexp regexp: |
| 8052 // - a reference to code for ASCII inputs (bytecode or compiled), or a smi | 8011 // - a reference to code for Latin1 inputs (bytecode or compiled), or a smi |
| 8053 // used for tracking the last usage (used for code flushing). | 8012 // used for tracking the last usage (used for code flushing). |
| 8054 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi | 8013 // - a reference to code for UC16 inputs (bytecode or compiled), or a smi |
| 8055 // used for tracking the last usage (used for code flushing).. | 8014 // used for tracking the last usage (used for code flushing).. |
| 8056 // - max number of registers used by irregexp implementations. | 8015 // - max number of registers used by irregexp implementations. |
| 8057 // - number of capture registers (output values) of the regexp. | 8016 // - number of capture registers (output values) of the regexp. |
| 8058 class JSRegExp: public JSObject { | 8017 class JSRegExp: public JSObject { |
| 8059 public: | 8018 public: |
| 8060 // Meaning of Type: | 8019 // Meaning of Type: |
| 8061 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. | 8020 // NOT_COMPILED: Initial value. No data has been stored in the JSRegExp yet. |
| 8062 // ATOM: A simple string to match against using an indexOf operation. | 8021 // ATOM: A simple string to match against using an indexOf operation. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 8079 DECL_ACCESSORS(data, Object) | 8038 DECL_ACCESSORS(data, Object) |
| 8080 | 8039 |
| 8081 inline Type TypeTag(); | 8040 inline Type TypeTag(); |
| 8082 inline int CaptureCount(); | 8041 inline int CaptureCount(); |
| 8083 inline Flags GetFlags(); | 8042 inline Flags GetFlags(); |
| 8084 inline String* Pattern(); | 8043 inline String* Pattern(); |
| 8085 inline Object* DataAt(int index); | 8044 inline Object* DataAt(int index); |
| 8086 // Set implementation data after the object has been prepared. | 8045 // Set implementation data after the object has been prepared. |
| 8087 inline void SetDataAt(int index, Object* value); | 8046 inline void SetDataAt(int index, Object* value); |
| 8088 | 8047 |
| 8089 static int code_index(bool is_ascii) { | 8048 static int code_index(bool is_latin1) { |
| 8090 if (is_ascii) { | 8049 if (is_latin1) { |
| 8091 return kIrregexpASCIICodeIndex; | 8050 return kIrregexpLatin1CodeIndex; |
| 8092 } else { | 8051 } else { |
| 8093 return kIrregexpUC16CodeIndex; | 8052 return kIrregexpUC16CodeIndex; |
| 8094 } | 8053 } |
| 8095 } | 8054 } |
| 8096 | 8055 |
| 8097 static int saved_code_index(bool is_ascii) { | 8056 static int saved_code_index(bool is_latin1) { |
| 8098 if (is_ascii) { | 8057 if (is_latin1) { |
| 8099 return kIrregexpASCIICodeSavedIndex; | 8058 return kIrregexpLatin1CodeSavedIndex; |
| 8100 } else { | 8059 } else { |
| 8101 return kIrregexpUC16CodeSavedIndex; | 8060 return kIrregexpUC16CodeSavedIndex; |
| 8102 } | 8061 } |
| 8103 } | 8062 } |
| 8104 | 8063 |
| 8105 DECLARE_CAST(JSRegExp) | 8064 DECLARE_CAST(JSRegExp) |
| 8106 | 8065 |
| 8107 // Dispatched behavior. | 8066 // Dispatched behavior. |
| 8108 DECLARE_VERIFIER(JSRegExp) | 8067 DECLARE_VERIFIER(JSRegExp) |
| 8109 | 8068 |
| 8110 static const int kDataOffset = JSObject::kHeaderSize; | 8069 static const int kDataOffset = JSObject::kHeaderSize; |
| 8111 static const int kSize = kDataOffset + kPointerSize; | 8070 static const int kSize = kDataOffset + kPointerSize; |
| 8112 | 8071 |
| 8113 // Indices in the data array. | 8072 // Indices in the data array. |
| 8114 static const int kTagIndex = 0; | 8073 static const int kTagIndex = 0; |
| 8115 static const int kSourceIndex = kTagIndex + 1; | 8074 static const int kSourceIndex = kTagIndex + 1; |
| 8116 static const int kFlagsIndex = kSourceIndex + 1; | 8075 static const int kFlagsIndex = kSourceIndex + 1; |
| 8117 static const int kDataIndex = kFlagsIndex + 1; | 8076 static const int kDataIndex = kFlagsIndex + 1; |
| 8118 // The data fields are used in different ways depending on the | 8077 // The data fields are used in different ways depending on the |
| 8119 // value of the tag. | 8078 // value of the tag. |
| 8120 // Atom regexps (literal strings). | 8079 // Atom regexps (literal strings). |
| 8121 static const int kAtomPatternIndex = kDataIndex; | 8080 static const int kAtomPatternIndex = kDataIndex; |
| 8122 | 8081 |
| 8123 static const int kAtomDataSize = kAtomPatternIndex + 1; | 8082 static const int kAtomDataSize = kAtomPatternIndex + 1; |
| 8124 | 8083 |
| 8125 // Irregexp compiled code or bytecode for ASCII. If compilation | 8084 // Irregexp compiled code or bytecode for Latin1. If compilation |
| 8126 // fails, this fields hold an exception object that should be | 8085 // fails, this fields hold an exception object that should be |
| 8127 // thrown if the regexp is used again. | 8086 // thrown if the regexp is used again. |
| 8128 static const int kIrregexpASCIICodeIndex = kDataIndex; | 8087 static const int kIrregexpLatin1CodeIndex = kDataIndex; |
| 8129 // Irregexp compiled code or bytecode for UC16. If compilation | 8088 // Irregexp compiled code or bytecode for UC16. If compilation |
| 8130 // fails, this fields hold an exception object that should be | 8089 // fails, this fields hold an exception object that should be |
| 8131 // thrown if the regexp is used again. | 8090 // thrown if the regexp is used again. |
| 8132 static const int kIrregexpUC16CodeIndex = kDataIndex + 1; | 8091 static const int kIrregexpUC16CodeIndex = kDataIndex + 1; |
| 8133 | 8092 |
| 8134 // Saved instance of Irregexp compiled code or bytecode for ASCII that | 8093 // Saved instance of Irregexp compiled code or bytecode for Latin1 that |
| 8135 // is a potential candidate for flushing. | 8094 // is a potential candidate for flushing. |
| 8136 static const int kIrregexpASCIICodeSavedIndex = kDataIndex + 2; | 8095 static const int kIrregexpLatin1CodeSavedIndex = kDataIndex + 2; |
| 8137 // Saved instance of Irregexp compiled code or bytecode for UC16 that is | 8096 // Saved instance of Irregexp compiled code or bytecode for UC16 that is |
| 8138 // a potential candidate for flushing. | 8097 // a potential candidate for flushing. |
| 8139 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; | 8098 static const int kIrregexpUC16CodeSavedIndex = kDataIndex + 3; |
| 8140 | 8099 |
| 8141 // Maximal number of registers used by either ASCII or UC16. | 8100 // Maximal number of registers used by either Latin1 or UC16. |
| 8142 // Only used to check that there is enough stack space | 8101 // Only used to check that there is enough stack space |
| 8143 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; | 8102 static const int kIrregexpMaxRegisterCountIndex = kDataIndex + 4; |
| 8144 // Number of captures in the compiled regexp. | 8103 // Number of captures in the compiled regexp. |
| 8145 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; | 8104 static const int kIrregexpCaptureCountIndex = kDataIndex + 5; |
| 8146 | 8105 |
| 8147 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; | 8106 static const int kIrregexpDataSize = kIrregexpCaptureCountIndex + 1; |
| 8148 | 8107 |
| 8149 // Offsets directly into the data fixed array. | 8108 // Offsets directly into the data fixed array. |
| 8150 static const int kDataTagOffset = | 8109 static const int kDataTagOffset = |
| 8151 FixedArray::kHeaderSize + kTagIndex * kPointerSize; | 8110 FixedArray::kHeaderSize + kTagIndex * kPointerSize; |
| 8152 static const int kDataAsciiCodeOffset = | 8111 static const int kDataOneByteCodeOffset = |
| 8153 FixedArray::kHeaderSize + kIrregexpASCIICodeIndex * kPointerSize; | 8112 FixedArray::kHeaderSize + kIrregexpLatin1CodeIndex * kPointerSize; |
| 8154 static const int kDataUC16CodeOffset = | 8113 static const int kDataUC16CodeOffset = |
| 8155 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; | 8114 FixedArray::kHeaderSize + kIrregexpUC16CodeIndex * kPointerSize; |
| 8156 static const int kIrregexpCaptureCountOffset = | 8115 static const int kIrregexpCaptureCountOffset = |
| 8157 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; | 8116 FixedArray::kHeaderSize + kIrregexpCaptureCountIndex * kPointerSize; |
| 8158 | 8117 |
| 8159 // In-object fields. | 8118 // In-object fields. |
| 8160 static const int kSourceFieldIndex = 0; | 8119 static const int kSourceFieldIndex = 0; |
| 8161 static const int kGlobalFieldIndex = 1; | 8120 static const int kGlobalFieldIndex = 1; |
| 8162 static const int kIgnoreCaseFieldIndex = 2; | 8121 static const int kIgnoreCaseFieldIndex = 2; |
| 8163 static const int kMultilineFieldIndex = 3; | 8122 static const int kMultilineFieldIndex = 3; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8780 class StringShape BASE_EMBEDDED { | 8739 class StringShape BASE_EMBEDDED { |
| 8781 public: | 8740 public: |
| 8782 inline explicit StringShape(const String* s); | 8741 inline explicit StringShape(const String* s); |
| 8783 inline explicit StringShape(Map* s); | 8742 inline explicit StringShape(Map* s); |
| 8784 inline explicit StringShape(InstanceType t); | 8743 inline explicit StringShape(InstanceType t); |
| 8785 inline bool IsSequential(); | 8744 inline bool IsSequential(); |
| 8786 inline bool IsExternal(); | 8745 inline bool IsExternal(); |
| 8787 inline bool IsCons(); | 8746 inline bool IsCons(); |
| 8788 inline bool IsSliced(); | 8747 inline bool IsSliced(); |
| 8789 inline bool IsIndirect(); | 8748 inline bool IsIndirect(); |
| 8790 inline bool IsExternalAscii(); | 8749 inline bool IsExternalOneByte(); |
| 8791 inline bool IsExternalTwoByte(); | 8750 inline bool IsExternalTwoByte(); |
| 8792 inline bool IsSequentialAscii(); | 8751 inline bool IsSequentialOneByte(); |
| 8793 inline bool IsSequentialTwoByte(); | 8752 inline bool IsSequentialTwoByte(); |
| 8794 inline bool IsInternalized(); | 8753 inline bool IsInternalized(); |
| 8795 inline StringRepresentationTag representation_tag(); | 8754 inline StringRepresentationTag representation_tag(); |
| 8796 inline uint32_t encoding_tag(); | 8755 inline uint32_t encoding_tag(); |
| 8797 inline uint32_t full_representation_tag(); | 8756 inline uint32_t full_representation_tag(); |
| 8798 inline uint32_t size_tag(); | 8757 inline uint32_t size_tag(); |
| 8799 #ifdef DEBUG | 8758 #ifdef DEBUG |
| 8800 inline uint32_t type() { return type_; } | 8759 inline uint32_t type() { return type_; } |
| 8801 inline void invalidate() { valid_ = false; } | 8760 inline void invalidate() { valid_ = false; } |
| 8802 inline bool valid() { return valid_; } | 8761 inline bool valid() { return valid_; } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8977 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); | 8936 STATIC_ASSERT(IS_POWER_OF_TWO(kMaxCachedArrayIndexLength + 1)); |
| 8978 | 8937 |
| 8979 static const unsigned int kContainsCachedArrayIndexMask = | 8938 static const unsigned int kContainsCachedArrayIndexMask = |
| 8980 (~static_cast<unsigned>(kMaxCachedArrayIndexLength) | 8939 (~static_cast<unsigned>(kMaxCachedArrayIndexLength) |
| 8981 << ArrayIndexLengthBits::kShift) | | 8940 << ArrayIndexLengthBits::kShift) | |
| 8982 kIsNotArrayIndexMask; | 8941 kIsNotArrayIndexMask; |
| 8983 | 8942 |
| 8984 // Representation of the flat content of a String. | 8943 // Representation of the flat content of a String. |
| 8985 // A non-flat string doesn't have flat content. | 8944 // A non-flat string doesn't have flat content. |
| 8986 // A flat string has content that's encoded as a sequence of either | 8945 // A flat string has content that's encoded as a sequence of either |
| 8987 // ASCII chars or two-byte UC16. | 8946 // one-byte chars or two-byte UC16. |
| 8988 // Returned by String::GetFlatContent(). | 8947 // Returned by String::GetFlatContent(). |
| 8989 class FlatContent { | 8948 class FlatContent { |
| 8990 public: | 8949 public: |
| 8991 // Returns true if the string is flat and this structure contains content. | 8950 // Returns true if the string is flat and this structure contains content. |
| 8992 bool IsFlat() { return state_ != NON_FLAT; } | 8951 bool IsFlat() { return state_ != NON_FLAT; } |
| 8993 // Returns true if the structure contains ASCII content. | 8952 // Returns true if the structure contains one-byte content. |
| 8994 bool IsAscii() { return state_ == ASCII; } | 8953 bool IsOneByte() { return state_ == ONE_BYTE; } |
| 8995 // Returns true if the structure contains two-byte content. | 8954 // Returns true if the structure contains two-byte content. |
| 8996 bool IsTwoByte() { return state_ == TWO_BYTE; } | 8955 bool IsTwoByte() { return state_ == TWO_BYTE; } |
| 8997 | 8956 |
| 8998 // Return the one byte content of the string. Only use if IsAscii() returns | 8957 // Return the one byte content of the string. Only use if IsOneByte() |
| 8999 // true. | 8958 // returns true. |
| 9000 Vector<const uint8_t> ToOneByteVector() { | 8959 Vector<const uint8_t> ToOneByteVector() { |
| 9001 DCHECK_EQ(ASCII, state_); | 8960 DCHECK_EQ(ONE_BYTE, state_); |
| 9002 return Vector<const uint8_t>(onebyte_start, length_); | 8961 return Vector<const uint8_t>(onebyte_start, length_); |
| 9003 } | 8962 } |
| 9004 // Return the two-byte content of the string. Only use if IsTwoByte() | 8963 // Return the two-byte content of the string. Only use if IsTwoByte() |
| 9005 // returns true. | 8964 // returns true. |
| 9006 Vector<const uc16> ToUC16Vector() { | 8965 Vector<const uc16> ToUC16Vector() { |
| 9007 DCHECK_EQ(TWO_BYTE, state_); | 8966 DCHECK_EQ(TWO_BYTE, state_); |
| 9008 return Vector<const uc16>(twobyte_start, length_); | 8967 return Vector<const uc16>(twobyte_start, length_); |
| 9009 } | 8968 } |
| 9010 | 8969 |
| 9011 uc16 Get(int i) { | 8970 uc16 Get(int i) { |
| 9012 DCHECK(i < length_); | 8971 DCHECK(i < length_); |
| 9013 DCHECK(state_ != NON_FLAT); | 8972 DCHECK(state_ != NON_FLAT); |
| 9014 if (state_ == ASCII) return onebyte_start[i]; | 8973 if (state_ == ONE_BYTE) return onebyte_start[i]; |
| 9015 return twobyte_start[i]; | 8974 return twobyte_start[i]; |
| 9016 } | 8975 } |
| 9017 | 8976 |
| 9018 private: | 8977 private: |
| 9019 enum State { NON_FLAT, ASCII, TWO_BYTE }; | 8978 enum State { NON_FLAT, ONE_BYTE, TWO_BYTE }; |
| 9020 | 8979 |
| 9021 // Constructors only used by String::GetFlatContent(). | 8980 // Constructors only used by String::GetFlatContent(). |
| 9022 explicit FlatContent(const uint8_t* start, int length) | 8981 explicit FlatContent(const uint8_t* start, int length) |
| 9023 : onebyte_start(start), length_(length), state_(ASCII) { } | 8982 : onebyte_start(start), length_(length), state_(ONE_BYTE) {} |
| 9024 explicit FlatContent(const uc16* start, int length) | 8983 explicit FlatContent(const uc16* start, int length) |
| 9025 : twobyte_start(start), length_(length), state_(TWO_BYTE) { } | 8984 : twobyte_start(start), length_(length), state_(TWO_BYTE) { } |
| 9026 FlatContent() : onebyte_start(NULL), length_(0), state_(NON_FLAT) { } | 8985 FlatContent() : onebyte_start(NULL), length_(0), state_(NON_FLAT) { } |
| 9027 | 8986 |
| 9028 union { | 8987 union { |
| 9029 const uint8_t* onebyte_start; | 8988 const uint8_t* onebyte_start; |
| 9030 const uc16* twobyte_start; | 8989 const uc16* twobyte_start; |
| 9031 }; | 8990 }; |
| 9032 int length_; | 8991 int length_; |
| 9033 State state_; | 8992 State state_; |
| 9034 | 8993 |
| 9035 friend class String; | 8994 friend class String; |
| 9036 }; | 8995 }; |
| 9037 | 8996 |
| 9038 // Get and set the length of the string. | 8997 // Get and set the length of the string. |
| 9039 inline int length() const; | 8998 inline int length() const; |
| 9040 inline void set_length(int value); | 8999 inline void set_length(int value); |
| 9041 | 9000 |
| 9042 // Get and set the length of the string using acquire loads and release | 9001 // Get and set the length of the string using acquire loads and release |
| 9043 // stores. | 9002 // stores. |
| 9044 inline int synchronized_length() const; | 9003 inline int synchronized_length() const; |
| 9045 inline void synchronized_set_length(int value); | 9004 inline void synchronized_set_length(int value); |
| 9046 | 9005 |
| 9047 // Returns whether this string has only ASCII chars, i.e. all of them can | 9006 // Returns whether this string has only one-byte chars, i.e. all of them can |
| 9048 // be ASCII encoded. This might be the case even if the string is | 9007 // be one-byte encoded. This might be the case even if the string is |
| 9049 // two-byte. Such strings may appear when the embedder prefers | 9008 // two-byte. Such strings may appear when the embedder prefers |
| 9050 // two-byte external representations even for ASCII data. | 9009 // two-byte external representations even for one-byte data. |
| 9051 inline bool IsOneByteRepresentation() const; | 9010 inline bool IsOneByteRepresentation() const; |
| 9052 inline bool IsTwoByteRepresentation() const; | 9011 inline bool IsTwoByteRepresentation() const; |
| 9053 | 9012 |
| 9054 // Cons and slices have an encoding flag that may not represent the actual | 9013 // Cons and slices have an encoding flag that may not represent the actual |
| 9055 // encoding of the underlying string. This is taken into account here. | 9014 // encoding of the underlying string. This is taken into account here. |
| 9056 // Requires: this->IsFlat() | 9015 // Requires: this->IsFlat() |
| 9057 inline bool IsOneByteRepresentationUnderneath(); | 9016 inline bool IsOneByteRepresentationUnderneath(); |
| 9058 inline bool IsTwoByteRepresentationUnderneath(); | 9017 inline bool IsTwoByteRepresentationUnderneath(); |
| 9059 | 9018 |
| 9060 // NOTE: this should be considered only a hint. False negatives are | 9019 // NOTE: this should be considered only a hint. False negatives are |
| (...skipping 27 matching lines...) Expand all Loading... |
| 9088 // If the string isn't flat, and therefore doesn't have flat content, the | 9047 // If the string isn't flat, and therefore doesn't have flat content, the |
| 9089 // returned structure will report so, and can't provide a vector of either | 9048 // returned structure will report so, and can't provide a vector of either |
| 9090 // kind. | 9049 // kind. |
| 9091 FlatContent GetFlatContent(); | 9050 FlatContent GetFlatContent(); |
| 9092 | 9051 |
| 9093 // Returns the parent of a sliced string or first part of a flat cons string. | 9052 // Returns the parent of a sliced string or first part of a flat cons string. |
| 9094 // Requires: StringShape(this).IsIndirect() && this->IsFlat() | 9053 // Requires: StringShape(this).IsIndirect() && this->IsFlat() |
| 9095 inline String* GetUnderlying(); | 9054 inline String* GetUnderlying(); |
| 9096 | 9055 |
| 9097 // Mark the string as an undetectable object. It only applies to | 9056 // Mark the string as an undetectable object. It only applies to |
| 9098 // ASCII and two byte string types. | 9057 // one-byte and two-byte string types. |
| 9099 bool MarkAsUndetectable(); | 9058 bool MarkAsUndetectable(); |
| 9100 | 9059 |
| 9101 // String equality operations. | 9060 // String equality operations. |
| 9102 inline bool Equals(String* other); | 9061 inline bool Equals(String* other); |
| 9103 inline static bool Equals(Handle<String> one, Handle<String> two); | 9062 inline static bool Equals(Handle<String> one, Handle<String> two); |
| 9104 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false); | 9063 bool IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match = false); |
| 9105 bool IsOneByteEqualTo(Vector<const uint8_t> str); | 9064 bool IsOneByteEqualTo(Vector<const uint8_t> str); |
| 9106 bool IsTwoByteEqualTo(Vector<const uc16> str); | 9065 bool IsTwoByteEqualTo(Vector<const uc16> str); |
| 9107 | 9066 |
| 9108 // Return a UTF8 representation of the string. The string is null | 9067 // Return a UTF8 representation of the string. The string is null |
| (...skipping 20 matching lines...) Expand all Loading... |
| 9129 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it | 9088 // ROBUST_STRING_TRAVERSAL invokes behaviour that is robust This means it |
| 9130 // handles unexpected data without causing assert failures and it does not | 9089 // handles unexpected data without causing assert failures and it does not |
| 9131 // do any heap allocations. This is useful when printing stack traces. | 9090 // do any heap allocations. This is useful when printing stack traces. |
| 9132 SmartArrayPointer<uc16> ToWideCString( | 9091 SmartArrayPointer<uc16> ToWideCString( |
| 9133 RobustnessFlag robustness_flag = FAST_STRING_TRAVERSAL); | 9092 RobustnessFlag robustness_flag = FAST_STRING_TRAVERSAL); |
| 9134 | 9093 |
| 9135 bool ComputeArrayIndex(uint32_t* index); | 9094 bool ComputeArrayIndex(uint32_t* index); |
| 9136 | 9095 |
| 9137 // Externalization. | 9096 // Externalization. |
| 9138 bool MakeExternal(v8::String::ExternalStringResource* resource); | 9097 bool MakeExternal(v8::String::ExternalStringResource* resource); |
| 9139 bool MakeExternal(v8::String::ExternalAsciiStringResource* resource); | 9098 bool MakeExternal(v8::String::ExternalOneByteStringResource* resource); |
| 9140 | 9099 |
| 9141 // Conversion. | 9100 // Conversion. |
| 9142 inline bool AsArrayIndex(uint32_t* index); | 9101 inline bool AsArrayIndex(uint32_t* index); |
| 9143 | 9102 |
| 9144 DECLARE_CAST(String) | 9103 DECLARE_CAST(String) |
| 9145 | 9104 |
| 9146 void PrintOn(FILE* out); | 9105 void PrintOn(FILE* out); |
| 9147 | 9106 |
| 9148 // For use during stack traces. Performs rudimentary sanity check. | 9107 // For use during stack traces. Performs rudimentary sanity check. |
| 9149 bool LooksValid(); | 9108 bool LooksValid(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9190 // Support for regular expressions. | 9149 // Support for regular expressions. |
| 9191 const uc16* GetTwoByteData(unsigned start); | 9150 const uc16* GetTwoByteData(unsigned start); |
| 9192 | 9151 |
| 9193 // Helper function for flattening strings. | 9152 // Helper function for flattening strings. |
| 9194 template <typename sinkchar> | 9153 template <typename sinkchar> |
| 9195 static void WriteToFlat(String* source, | 9154 static void WriteToFlat(String* source, |
| 9196 sinkchar* sink, | 9155 sinkchar* sink, |
| 9197 int from, | 9156 int from, |
| 9198 int to); | 9157 int to); |
| 9199 | 9158 |
| 9200 // The return value may point to the first aligned word containing the | 9159 // The return value may point to the first aligned word containing the first |
| 9201 // first non-ascii character, rather than directly to the non-ascii character. | 9160 // non-one-byte character, rather than directly to the non-one-byte character. |
| 9202 // If the return value is >= the passed length, the entire string was ASCII. | 9161 // If the return value is >= the passed length, the entire string was |
| 9162 // one-byte. |
| 9203 static inline int NonAsciiStart(const char* chars, int length) { | 9163 static inline int NonAsciiStart(const char* chars, int length) { |
| 9204 const char* start = chars; | 9164 const char* start = chars; |
| 9205 const char* limit = chars + length; | 9165 const char* limit = chars + length; |
| 9206 #ifdef V8_HOST_CAN_READ_UNALIGNED | 9166 #ifdef V8_HOST_CAN_READ_UNALIGNED |
| 9207 DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F); | 9167 DCHECK(unibrow::Utf8::kMaxOneByteChar == 0x7F); |
| 9208 const uintptr_t non_ascii_mask = kUintptrAllBitsSet / 0xFF * 0x80; | 9168 const uintptr_t non_one_byte_mask = kUintptrAllBitsSet / 0xFF * 0x80; |
| 9209 while (chars + sizeof(uintptr_t) <= limit) { | 9169 while (chars + sizeof(uintptr_t) <= limit) { |
| 9210 if (*reinterpret_cast<const uintptr_t*>(chars) & non_ascii_mask) { | 9170 if (*reinterpret_cast<const uintptr_t*>(chars) & non_one_byte_mask) { |
| 9211 return static_cast<int>(chars - start); | 9171 return static_cast<int>(chars - start); |
| 9212 } | 9172 } |
| 9213 chars += sizeof(uintptr_t); | 9173 chars += sizeof(uintptr_t); |
| 9214 } | 9174 } |
| 9215 #endif | 9175 #endif |
| 9216 while (chars < limit) { | 9176 while (chars < limit) { |
| 9217 if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) { | 9177 if (static_cast<uint8_t>(*chars) > unibrow::Utf8::kMaxOneByteChar) { |
| 9218 return static_cast<int>(chars - start); | 9178 return static_cast<int>(chars - start); |
| 9219 } | 9179 } |
| 9220 ++chars; | 9180 ++chars; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9292 // Truncate the string in-place if possible and return the result. | 9252 // Truncate the string in-place if possible and return the result. |
| 9293 // In case of new_length == 0, the empty string is returned without | 9253 // In case of new_length == 0, the empty string is returned without |
| 9294 // truncating the original string. | 9254 // truncating the original string. |
| 9295 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string, | 9255 MUST_USE_RESULT static Handle<String> Truncate(Handle<SeqString> string, |
| 9296 int new_length); | 9256 int new_length); |
| 9297 private: | 9257 private: |
| 9298 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); | 9258 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqString); |
| 9299 }; | 9259 }; |
| 9300 | 9260 |
| 9301 | 9261 |
| 9302 // The AsciiString class captures sequential ASCII string objects. | 9262 // The OneByteString class captures sequential one-byte string objects. |
| 9303 // Each character in the AsciiString is an ASCII character. | 9263 // Each character in the OneByteString is an one-byte character. |
| 9304 class SeqOneByteString: public SeqString { | 9264 class SeqOneByteString: public SeqString { |
| 9305 public: | 9265 public: |
| 9306 static const bool kHasAsciiEncoding = true; | 9266 static const bool kHasOneByteEncoding = true; |
| 9307 | 9267 |
| 9308 // Dispatched behavior. | 9268 // Dispatched behavior. |
| 9309 inline uint16_t SeqOneByteStringGet(int index); | 9269 inline uint16_t SeqOneByteStringGet(int index); |
| 9310 inline void SeqOneByteStringSet(int index, uint16_t value); | 9270 inline void SeqOneByteStringSet(int index, uint16_t value); |
| 9311 | 9271 |
| 9312 // Get the address of the characters in this string. | 9272 // Get the address of the characters in this string. |
| 9313 inline Address GetCharsAddress(); | 9273 inline Address GetCharsAddress(); |
| 9314 | 9274 |
| 9315 inline uint8_t* GetChars(); | 9275 inline uint8_t* GetChars(); |
| 9316 | 9276 |
| 9317 DECLARE_CAST(SeqOneByteString) | 9277 DECLARE_CAST(SeqOneByteString) |
| 9318 | 9278 |
| 9319 // Garbage collection support. This method is called by the | 9279 // Garbage collection support. This method is called by the |
| 9320 // garbage collector to compute the actual size of an AsciiString | 9280 // garbage collector to compute the actual size of an OneByteString |
| 9321 // instance. | 9281 // instance. |
| 9322 inline int SeqOneByteStringSize(InstanceType instance_type); | 9282 inline int SeqOneByteStringSize(InstanceType instance_type); |
| 9323 | 9283 |
| 9324 // Computes the size for an AsciiString instance of a given length. | 9284 // Computes the size for an OneByteString instance of a given length. |
| 9325 static int SizeFor(int length) { | 9285 static int SizeFor(int length) { |
| 9326 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); | 9286 return OBJECT_POINTER_ALIGN(kHeaderSize + length * kCharSize); |
| 9327 } | 9287 } |
| 9328 | 9288 |
| 9329 // Maximal memory usage for a single sequential ASCII string. | 9289 // Maximal memory usage for a single sequential one-byte string. |
| 9330 static const int kMaxSize = 512 * MB - 1; | 9290 static const int kMaxSize = 512 * MB - 1; |
| 9331 STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength); | 9291 STATIC_ASSERT((kMaxSize - kHeaderSize) >= String::kMaxLength); |
| 9332 | 9292 |
| 9333 private: | 9293 private: |
| 9334 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); | 9294 DISALLOW_IMPLICIT_CONSTRUCTORS(SeqOneByteString); |
| 9335 }; | 9295 }; |
| 9336 | 9296 |
| 9337 | 9297 |
| 9338 // The TwoByteString class captures sequential unicode string objects. | 9298 // The TwoByteString class captures sequential unicode string objects. |
| 9339 // Each character in the TwoByteString is a two-byte uint16_t. | 9299 // Each character in the TwoByteString is a two-byte uint16_t. |
| 9340 class SeqTwoByteString: public SeqString { | 9300 class SeqTwoByteString: public SeqString { |
| 9341 public: | 9301 public: |
| 9342 static const bool kHasAsciiEncoding = false; | 9302 static const bool kHasOneByteEncoding = false; |
| 9343 | 9303 |
| 9344 // Dispatched behavior. | 9304 // Dispatched behavior. |
| 9345 inline uint16_t SeqTwoByteStringGet(int index); | 9305 inline uint16_t SeqTwoByteStringGet(int index); |
| 9346 inline void SeqTwoByteStringSet(int index, uint16_t value); | 9306 inline void SeqTwoByteStringSet(int index, uint16_t value); |
| 9347 | 9307 |
| 9348 // Get the address of the characters in this string. | 9308 // Get the address of the characters in this string. |
| 9349 inline Address GetCharsAddress(); | 9309 inline Address GetCharsAddress(); |
| 9350 | 9310 |
| 9351 inline uc16* GetChars(); | 9311 inline uc16* GetChars(); |
| 9352 | 9312 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9493 // Return whether external string is short (data pointer is not cached). | 9453 // Return whether external string is short (data pointer is not cached). |
| 9494 inline bool is_short(); | 9454 inline bool is_short(); |
| 9495 | 9455 |
| 9496 STATIC_ASSERT(kResourceOffset == Internals::kStringResourceOffset); | 9456 STATIC_ASSERT(kResourceOffset == Internals::kStringResourceOffset); |
| 9497 | 9457 |
| 9498 private: | 9458 private: |
| 9499 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); | 9459 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalString); |
| 9500 }; | 9460 }; |
| 9501 | 9461 |
| 9502 | 9462 |
| 9503 // The ExternalAsciiString class is an external string backed by an | 9463 // The ExternalOneByteString class is an external string backed by an |
| 9504 // ASCII string. | 9464 // one-byte string. |
| 9505 class ExternalAsciiString: public ExternalString { | 9465 class ExternalOneByteString : public ExternalString { |
| 9506 public: | 9466 public: |
| 9507 static const bool kHasAsciiEncoding = true; | 9467 static const bool kHasOneByteEncoding = true; |
| 9508 | 9468 |
| 9509 typedef v8::String::ExternalAsciiStringResource Resource; | 9469 typedef v8::String::ExternalOneByteStringResource Resource; |
| 9510 | 9470 |
| 9511 // The underlying resource. | 9471 // The underlying resource. |
| 9512 inline const Resource* resource(); | 9472 inline const Resource* resource(); |
| 9513 inline void set_resource(const Resource* buffer); | 9473 inline void set_resource(const Resource* buffer); |
| 9514 | 9474 |
| 9515 // Update the pointer cache to the external character array. | 9475 // Update the pointer cache to the external character array. |
| 9516 // The cached pointer is always valid, as the external character array does = | 9476 // The cached pointer is always valid, as the external character array does = |
| 9517 // not move during lifetime. Deserialization is the only exception, after | 9477 // not move during lifetime. Deserialization is the only exception, after |
| 9518 // which the pointer cache has to be refreshed. | 9478 // which the pointer cache has to be refreshed. |
| 9519 inline void update_data_cache(); | 9479 inline void update_data_cache(); |
| 9520 | 9480 |
| 9521 inline const uint8_t* GetChars(); | 9481 inline const uint8_t* GetChars(); |
| 9522 | 9482 |
| 9523 // Dispatched behavior. | 9483 // Dispatched behavior. |
| 9524 inline uint16_t ExternalAsciiStringGet(int index); | 9484 inline uint16_t ExternalOneByteStringGet(int index); |
| 9525 | 9485 |
| 9526 DECLARE_CAST(ExternalAsciiString) | 9486 DECLARE_CAST(ExternalOneByteString) |
| 9527 | 9487 |
| 9528 // Garbage collection support. | 9488 // Garbage collection support. |
| 9529 inline void ExternalAsciiStringIterateBody(ObjectVisitor* v); | 9489 inline void ExternalOneByteStringIterateBody(ObjectVisitor* v); |
| 9530 | 9490 |
| 9531 template<typename StaticVisitor> | 9491 template <typename StaticVisitor> |
| 9532 inline void ExternalAsciiStringIterateBody(); | 9492 inline void ExternalOneByteStringIterateBody(); |
| 9533 | 9493 |
| 9534 private: | 9494 private: |
| 9535 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalAsciiString); | 9495 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalOneByteString); |
| 9536 }; | 9496 }; |
| 9537 | 9497 |
| 9538 | 9498 |
| 9539 // The ExternalTwoByteString class is an external string backed by a UTF-16 | 9499 // The ExternalTwoByteString class is an external string backed by a UTF-16 |
| 9540 // encoded string. | 9500 // encoded string. |
| 9541 class ExternalTwoByteString: public ExternalString { | 9501 class ExternalTwoByteString: public ExternalString { |
| 9542 public: | 9502 public: |
| 9543 static const bool kHasAsciiEncoding = false; | 9503 static const bool kHasOneByteEncoding = false; |
| 9544 | 9504 |
| 9545 typedef v8::String::ExternalStringResource Resource; | 9505 typedef v8::String::ExternalStringResource Resource; |
| 9546 | 9506 |
| 9547 // The underlying string resource. | 9507 // The underlying string resource. |
| 9548 inline const Resource* resource(); | 9508 inline const Resource* resource(); |
| 9549 inline void set_resource(const Resource* buffer); | 9509 inline void set_resource(const Resource* buffer); |
| 9550 | 9510 |
| 9551 // Update the pointer cache to the external character array. | 9511 // Update the pointer cache to the external character array. |
| 9552 // The cached pointer is always valid, as the external character array does = | 9512 // The cached pointer is always valid, as the external character array does = |
| 9553 // not move during lifetime. Deserialization is the only exception, after | 9513 // not move during lifetime. Deserialization is the only exception, after |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9604 // must be valid as long as the reader is being used. | 9564 // must be valid as long as the reader is being used. |
| 9605 class FlatStringReader : public Relocatable { | 9565 class FlatStringReader : public Relocatable { |
| 9606 public: | 9566 public: |
| 9607 FlatStringReader(Isolate* isolate, Handle<String> str); | 9567 FlatStringReader(Isolate* isolate, Handle<String> str); |
| 9608 FlatStringReader(Isolate* isolate, Vector<const char> input); | 9568 FlatStringReader(Isolate* isolate, Vector<const char> input); |
| 9609 void PostGarbageCollection(); | 9569 void PostGarbageCollection(); |
| 9610 inline uc32 Get(int index); | 9570 inline uc32 Get(int index); |
| 9611 int length() { return length_; } | 9571 int length() { return length_; } |
| 9612 private: | 9572 private: |
| 9613 String** str_; | 9573 String** str_; |
| 9614 bool is_ascii_; | 9574 bool is_one_byte_; |
| 9615 int length_; | 9575 int length_; |
| 9616 const void* start_; | 9576 const void* start_; |
| 9617 }; | 9577 }; |
| 9618 | 9578 |
| 9619 | 9579 |
| 9620 // A ConsStringOp that returns null. | 9580 // A ConsStringOp that returns null. |
| 9621 // Useful when the operation to apply on a ConsString | 9581 // Useful when the operation to apply on a ConsString |
| 9622 // requires an expensive data structure. | 9582 // requires an expensive data structure. |
| 9623 class ConsStringNullOp { | 9583 class ConsStringNullOp { |
| 9624 public: | 9584 public: |
| (...skipping 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11085 | 11045 |
| 11086 // Visits a code entry in a JS function. | 11046 // Visits a code entry in a JS function. |
| 11087 virtual void VisitCodeEntry(Address entry_address); | 11047 virtual void VisitCodeEntry(Address entry_address); |
| 11088 | 11048 |
| 11089 // Visits a global property cell reference in the instruction stream. | 11049 // Visits a global property cell reference in the instruction stream. |
| 11090 virtual void VisitCell(RelocInfo* rinfo); | 11050 virtual void VisitCell(RelocInfo* rinfo); |
| 11091 | 11051 |
| 11092 // Visits a runtime entry in the instruction stream. | 11052 // Visits a runtime entry in the instruction stream. |
| 11093 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} | 11053 virtual void VisitRuntimeEntry(RelocInfo* rinfo) {} |
| 11094 | 11054 |
| 11095 // Visits the resource of an ASCII or two-byte string. | 11055 // Visits the resource of an one-byte or two-byte string. |
| 11096 virtual void VisitExternalAsciiString( | 11056 virtual void VisitExternalOneByteString( |
| 11097 v8::String::ExternalAsciiStringResource** resource) {} | 11057 v8::String::ExternalOneByteStringResource** resource) {} |
| 11098 virtual void VisitExternalTwoByteString( | 11058 virtual void VisitExternalTwoByteString( |
| 11099 v8::String::ExternalStringResource** resource) {} | 11059 v8::String::ExternalStringResource** resource) {} |
| 11100 | 11060 |
| 11101 // Visits a debug call target in the instruction stream. | 11061 // Visits a debug call target in the instruction stream. |
| 11102 virtual void VisitDebugTarget(RelocInfo* rinfo); | 11062 virtual void VisitDebugTarget(RelocInfo* rinfo); |
| 11103 | 11063 |
| 11104 // Visits the byte sequence in a function's prologue that contains information | 11064 // Visits the byte sequence in a function's prologue that contains information |
| 11105 // about the code's age. | 11065 // about the code's age. |
| 11106 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); | 11066 virtual void VisitCodeAgeSequence(RelocInfo* rinfo); |
| 11107 | 11067 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11155 } else { | 11115 } else { |
| 11156 value &= ~(1 << bit_position); | 11116 value &= ~(1 << bit_position); |
| 11157 } | 11117 } |
| 11158 return value; | 11118 return value; |
| 11159 } | 11119 } |
| 11160 }; | 11120 }; |
| 11161 | 11121 |
| 11162 } } // namespace v8::internal | 11122 } } // namespace v8::internal |
| 11163 | 11123 |
| 11164 #endif // V8_OBJECTS_H_ | 11124 #endif // V8_OBJECTS_H_ |
| OLD | NEW |