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

Side by Side Diff: src/objects.h

Issue 6697023: Merge 6800:7180 from the bleeding edge branch to the experimental/gc branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/gc/
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // - JSArray 50 // - JSArray
51 // - JSRegExp 51 // - JSRegExp
52 // - JSFunction 52 // - JSFunction
53 // - GlobalObject 53 // - GlobalObject
54 // - JSGlobalObject 54 // - JSGlobalObject
55 // - JSBuiltinsObject 55 // - JSBuiltinsObject
56 // - JSGlobalProxy 56 // - JSGlobalProxy
57 // - JSValue 57 // - JSValue
58 // - JSMessageObject 58 // - JSMessageObject
59 // - ByteArray 59 // - ByteArray
60 // - PixelArray
61 // - ExternalArray 60 // - ExternalArray
61 // - ExternalPixelArray
62 // - ExternalByteArray 62 // - ExternalByteArray
63 // - ExternalUnsignedByteArray 63 // - ExternalUnsignedByteArray
64 // - ExternalShortArray 64 // - ExternalShortArray
65 // - ExternalUnsignedShortArray 65 // - ExternalUnsignedShortArray
66 // - ExternalIntArray 66 // - ExternalIntArray
67 // - ExternalUnsignedIntArray 67 // - ExternalUnsignedIntArray
68 // - ExternalFloatArray 68 // - ExternalFloatArray
69 // - FixedArray 69 // - FixedArray
70 // - DescriptorArray 70 // - DescriptorArray
71 // - HashTable 71 // - HashTable
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \ 255 V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \
256 \ 256 \
257 V(MAP_TYPE) \ 257 V(MAP_TYPE) \
258 V(CODE_TYPE) \ 258 V(CODE_TYPE) \
259 V(ODDBALL_TYPE) \ 259 V(ODDBALL_TYPE) \
260 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \ 260 V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
261 \ 261 \
262 V(HEAP_NUMBER_TYPE) \ 262 V(HEAP_NUMBER_TYPE) \
263 V(PROXY_TYPE) \ 263 V(PROXY_TYPE) \
264 V(BYTE_ARRAY_TYPE) \ 264 V(BYTE_ARRAY_TYPE) \
265 V(PIXEL_ARRAY_TYPE) \
266 /* Note: the order of these external array */ \ 265 /* Note: the order of these external array */ \
267 /* types is relied upon in */ \ 266 /* types is relied upon in */ \
268 /* Object::IsExternalArray(). */ \ 267 /* Object::IsExternalArray(). */ \
269 V(EXTERNAL_BYTE_ARRAY_TYPE) \ 268 V(EXTERNAL_BYTE_ARRAY_TYPE) \
270 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \ 269 V(EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE) \
271 V(EXTERNAL_SHORT_ARRAY_TYPE) \ 270 V(EXTERNAL_SHORT_ARRAY_TYPE) \
272 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \ 271 V(EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE) \
273 V(EXTERNAL_INT_ARRAY_TYPE) \ 272 V(EXTERNAL_INT_ARRAY_TYPE) \
274 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \ 273 V(EXTERNAL_UNSIGNED_INT_ARRAY_TYPE) \
275 V(EXTERNAL_FLOAT_ARRAY_TYPE) \ 274 V(EXTERNAL_FLOAT_ARRAY_TYPE) \
275 V(EXTERNAL_PIXEL_ARRAY_TYPE) \
276 V(FILLER_TYPE) \ 276 V(FILLER_TYPE) \
277 \ 277 \
278 V(ACCESSOR_INFO_TYPE) \ 278 V(ACCESSOR_INFO_TYPE) \
279 V(ACCESS_CHECK_INFO_TYPE) \ 279 V(ACCESS_CHECK_INFO_TYPE) \
280 V(INTERCEPTOR_INFO_TYPE) \ 280 V(INTERCEPTOR_INFO_TYPE) \
281 V(CALL_HANDLER_INFO_TYPE) \ 281 V(CALL_HANDLER_INFO_TYPE) \
282 V(FUNCTION_TEMPLATE_INFO_TYPE) \ 282 V(FUNCTION_TEMPLATE_INFO_TYPE) \
283 V(OBJECT_TEMPLATE_INFO_TYPE) \ 283 V(OBJECT_TEMPLATE_INFO_TYPE) \
284 V(SIGNATURE_INFO_TYPE) \ 284 V(SIGNATURE_INFO_TYPE) \
285 V(TYPE_SWITCH_INFO_TYPE) \ 285 V(TYPE_SWITCH_INFO_TYPE) \
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE 483 MAP_TYPE = kNotStringTag, // FIRST_NONSTRING_TYPE
484 CODE_TYPE, 484 CODE_TYPE,
485 ODDBALL_TYPE, 485 ODDBALL_TYPE,
486 JS_GLOBAL_PROPERTY_CELL_TYPE, 486 JS_GLOBAL_PROPERTY_CELL_TYPE,
487 487
488 // "Data", objects that cannot contain non-map-word pointers to heap 488 // "Data", objects that cannot contain non-map-word pointers to heap
489 // objects. 489 // objects.
490 HEAP_NUMBER_TYPE, 490 HEAP_NUMBER_TYPE,
491 PROXY_TYPE, 491 PROXY_TYPE,
492 BYTE_ARRAY_TYPE, 492 BYTE_ARRAY_TYPE,
493 PIXEL_ARRAY_TYPE,
494 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE 493 EXTERNAL_BYTE_ARRAY_TYPE, // FIRST_EXTERNAL_ARRAY_TYPE
495 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE, 494 EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE,
496 EXTERNAL_SHORT_ARRAY_TYPE, 495 EXTERNAL_SHORT_ARRAY_TYPE,
497 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE, 496 EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE,
498 EXTERNAL_INT_ARRAY_TYPE, 497 EXTERNAL_INT_ARRAY_TYPE,
499 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE, 498 EXTERNAL_UNSIGNED_INT_ARRAY_TYPE,
500 EXTERNAL_FLOAT_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE 499 EXTERNAL_FLOAT_ARRAY_TYPE,
500 EXTERNAL_PIXEL_ARRAY_TYPE, // LAST_EXTERNAL_ARRAY_TYPE
501 FILLER_TYPE, // LAST_DATA_TYPE 501 FILLER_TYPE, // LAST_DATA_TYPE
502 502
503 // Structs. 503 // Structs.
504 ACCESSOR_INFO_TYPE, 504 ACCESSOR_INFO_TYPE,
505 ACCESS_CHECK_INFO_TYPE, 505 ACCESS_CHECK_INFO_TYPE,
506 INTERCEPTOR_INFO_TYPE, 506 INTERCEPTOR_INFO_TYPE,
507 CALL_HANDLER_INFO_TYPE, 507 CALL_HANDLER_INFO_TYPE,
508 FUNCTION_TEMPLATE_INFO_TYPE, 508 FUNCTION_TEMPLATE_INFO_TYPE,
509 OBJECT_TEMPLATE_INFO_TYPE, 509 OBJECT_TEMPLATE_INFO_TYPE,
510 SIGNATURE_INFO_TYPE, 510 SIGNATURE_INFO_TYPE,
(...skipping 26 matching lines...) Expand all
537 537
538 // Pseudo-types 538 // Pseudo-types
539 FIRST_TYPE = 0x0, 539 FIRST_TYPE = 0x0,
540 LAST_TYPE = JS_FUNCTION_TYPE, 540 LAST_TYPE = JS_FUNCTION_TYPE,
541 INVALID_TYPE = FIRST_TYPE - 1, 541 INVALID_TYPE = FIRST_TYPE - 1,
542 FIRST_NONSTRING_TYPE = MAP_TYPE, 542 FIRST_NONSTRING_TYPE = MAP_TYPE,
543 FIRST_STRING_TYPE = FIRST_TYPE, 543 FIRST_STRING_TYPE = FIRST_TYPE,
544 LAST_STRING_TYPE = FIRST_NONSTRING_TYPE - 1, 544 LAST_STRING_TYPE = FIRST_NONSTRING_TYPE - 1,
545 // Boundaries for testing for an external array. 545 // Boundaries for testing for an external array.
546 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE, 546 FIRST_EXTERNAL_ARRAY_TYPE = EXTERNAL_BYTE_ARRAY_TYPE,
547 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_FLOAT_ARRAY_TYPE, 547 LAST_EXTERNAL_ARRAY_TYPE = EXTERNAL_PIXEL_ARRAY_TYPE,
548 // Boundary for promotion to old data space/old pointer space. 548 // Boundary for promotion to old data space/old pointer space.
549 LAST_DATA_TYPE = FILLER_TYPE, 549 LAST_DATA_TYPE = FILLER_TYPE,
550 // Boundaries for testing the type is a JavaScript "object". Note that 550 // Boundaries for testing the type is a JavaScript "object". Note that
551 // function objects are not counted as objects, even though they are 551 // function objects are not counted as objects, even though they are
552 // implemented as such; only values whose typeof is "object" are included. 552 // implemented as such; only values whose typeof is "object" are included.
553 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE, 553 FIRST_JS_OBJECT_TYPE = JS_VALUE_TYPE,
554 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE, 554 LAST_JS_OBJECT_TYPE = JS_REGEXP_TYPE,
555 // RegExp objects have [[Class]] "function" because they are callable. 555 // RegExp objects have [[Class]] "function" because they are callable.
556 // All types from this type and above are objects with [[Class]] "function". 556 // All types from this type and above are objects with [[Class]] "function".
557 FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE 557 FIRST_FUNCTION_CLASS_TYPE = JS_REGEXP_TYPE
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 V(String) \ 648 V(String) \
649 V(Symbol) \ 649 V(Symbol) \
650 V(SeqString) \ 650 V(SeqString) \
651 V(ExternalString) \ 651 V(ExternalString) \
652 V(ConsString) \ 652 V(ConsString) \
653 V(ExternalTwoByteString) \ 653 V(ExternalTwoByteString) \
654 V(ExternalAsciiString) \ 654 V(ExternalAsciiString) \
655 V(SeqTwoByteString) \ 655 V(SeqTwoByteString) \
656 V(SeqAsciiString) \ 656 V(SeqAsciiString) \
657 \ 657 \
658 V(PixelArray) \
659 V(ExternalArray) \ 658 V(ExternalArray) \
660 V(ExternalByteArray) \ 659 V(ExternalByteArray) \
661 V(ExternalUnsignedByteArray) \ 660 V(ExternalUnsignedByteArray) \
662 V(ExternalShortArray) \ 661 V(ExternalShortArray) \
663 V(ExternalUnsignedShortArray) \ 662 V(ExternalUnsignedShortArray) \
664 V(ExternalIntArray) \ 663 V(ExternalIntArray) \
665 V(ExternalUnsignedIntArray) \ 664 V(ExternalUnsignedIntArray) \
666 V(ExternalFloatArray) \ 665 V(ExternalFloatArray) \
666 V(ExternalPixelArray) \
667 V(ByteArray) \ 667 V(ByteArray) \
668 V(JSObject) \ 668 V(JSObject) \
669 V(JSContextExtensionObject) \ 669 V(JSContextExtensionObject) \
670 V(Map) \ 670 V(Map) \
671 V(DescriptorArray) \ 671 V(DescriptorArray) \
672 V(DeoptimizationInputData) \ 672 V(DeoptimizationInputData) \
673 V(DeoptimizationOutputData) \ 673 V(DeoptimizationOutputData) \
674 V(FixedArray) \ 674 V(FixedArray) \
675 V(Context) \ 675 V(Context) \
676 V(CatchContext) \ 676 V(CatchContext) \
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 NORMAL_DELETION, 1191 NORMAL_DELETION,
1192 STRICT_DELETION, 1192 STRICT_DELETION,
1193 FORCE_DELETION 1193 FORCE_DELETION
1194 }; 1194 };
1195 1195
1196 enum ElementsKind { 1196 enum ElementsKind {
1197 // The only "fast" kind. 1197 // The only "fast" kind.
1198 FAST_ELEMENTS, 1198 FAST_ELEMENTS,
1199 // All the kinds below are "slow". 1199 // All the kinds below are "slow".
1200 DICTIONARY_ELEMENTS, 1200 DICTIONARY_ELEMENTS,
1201 PIXEL_ELEMENTS,
1202 EXTERNAL_BYTE_ELEMENTS, 1201 EXTERNAL_BYTE_ELEMENTS,
1203 EXTERNAL_UNSIGNED_BYTE_ELEMENTS, 1202 EXTERNAL_UNSIGNED_BYTE_ELEMENTS,
1204 EXTERNAL_SHORT_ELEMENTS, 1203 EXTERNAL_SHORT_ELEMENTS,
1205 EXTERNAL_UNSIGNED_SHORT_ELEMENTS, 1204 EXTERNAL_UNSIGNED_SHORT_ELEMENTS,
1206 EXTERNAL_INT_ELEMENTS, 1205 EXTERNAL_INT_ELEMENTS,
1207 EXTERNAL_UNSIGNED_INT_ELEMENTS, 1206 EXTERNAL_UNSIGNED_INT_ELEMENTS,
1208 EXTERNAL_FLOAT_ELEMENTS 1207 EXTERNAL_FLOAT_ELEMENTS,
1208 EXTERNAL_PIXEL_ELEMENTS
1209 }; 1209 };
1210 1210
1211 // [properties]: Backing storage for properties. 1211 // [properties]: Backing storage for properties.
1212 // properties is a FixedArray in the fast case and a Dictionary in the 1212 // properties is a FixedArray in the fast case and a Dictionary in the
1213 // slow case. 1213 // slow case.
1214 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties. 1214 DECL_ACCESSORS(properties, FixedArray) // Get and set fast properties.
1215 inline void initialize_properties(); 1215 inline void initialize_properties();
1216 inline bool HasFastProperties(); 1216 inline bool HasFastProperties();
1217 inline StringDictionary* property_dictionary(); // Gets slow properties. 1217 inline StringDictionary* property_dictionary(); // Gets slow properties.
1218 1218
1219 // [elements]: The elements (properties with names that are integers). 1219 // [elements]: The elements (properties with names that are integers).
1220 // 1220 //
1221 // Elements can be in two general modes: fast and slow. Each mode 1221 // Elements can be in two general modes: fast and slow. Each mode
1222 // corrensponds to a set of object representations of elements that 1222 // corrensponds to a set of object representations of elements that
1223 // have something in common. 1223 // have something in common.
1224 // 1224 //
1225 // In the fast mode elements is a FixedArray and so each element can 1225 // In the fast mode elements is a FixedArray and so each element can
1226 // be quickly accessed. This fact is used in the generated code. The 1226 // be quickly accessed. This fact is used in the generated code. The
1227 // elements array can have one of the two maps in this mode: 1227 // elements array can have one of the two maps in this mode:
1228 // fixed_array_map or fixed_cow_array_map (for copy-on-write 1228 // fixed_array_map or fixed_cow_array_map (for copy-on-write
1229 // arrays). In the latter case the elements array may be shared by a 1229 // arrays). In the latter case the elements array may be shared by a
1230 // few objects and so before writing to any element the array must 1230 // few objects and so before writing to any element the array must
1231 // be copied. Use EnsureWritableFastElements in this case. 1231 // be copied. Use EnsureWritableFastElements in this case.
1232 // 1232 //
1233 // In the slow mode elements is either a NumberDictionary or a 1233 // In the slow mode elements is either a NumberDictionary or an ExternalArray.
1234 // PixelArray or an ExternalArray.
1235 DECL_ACCESSORS(elements, HeapObject) 1234 DECL_ACCESSORS(elements, HeapObject)
1236 inline void initialize_elements(); 1235 inline void initialize_elements();
1237 MUST_USE_RESULT inline MaybeObject* ResetElements(); 1236 MUST_USE_RESULT inline MaybeObject* ResetElements();
1238 inline ElementsKind GetElementsKind(); 1237 inline ElementsKind GetElementsKind();
1239 inline bool HasFastElements(); 1238 inline bool HasFastElements();
1240 inline bool HasDictionaryElements(); 1239 inline bool HasDictionaryElements();
1241 inline bool HasPixelElements(); 1240 inline bool HasExternalPixelElements();
1242 inline bool HasExternalArrayElements(); 1241 inline bool HasExternalArrayElements();
1243 inline bool HasExternalByteElements(); 1242 inline bool HasExternalByteElements();
1244 inline bool HasExternalUnsignedByteElements(); 1243 inline bool HasExternalUnsignedByteElements();
1245 inline bool HasExternalShortElements(); 1244 inline bool HasExternalShortElements();
1246 inline bool HasExternalUnsignedShortElements(); 1245 inline bool HasExternalUnsignedShortElements();
1247 inline bool HasExternalIntElements(); 1246 inline bool HasExternalIntElements();
1248 inline bool HasExternalUnsignedIntElements(); 1247 inline bool HasExternalUnsignedIntElements();
1249 inline bool HasExternalFloatElements(); 1248 inline bool HasExternalFloatElements();
1250 inline bool AllowsSetElementsLength(); 1249 inline bool AllowsSetElementsLength();
1251 inline NumberDictionary* element_dictionary(); // Gets slow elements. 1250 inline NumberDictionary* element_dictionary(); // Gets slow elements.
1252 // Requires: this->HasFastElements(). 1251 // Requires: this->HasFastElements().
1253 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements(); 1252 MUST_USE_RESULT inline MaybeObject* EnsureWritableFastElements();
1254 1253
1255 // Collects elements starting at index 0. 1254 // Collects elements starting at index 0.
1256 // Undefined values are placed after non-undefined values. 1255 // Undefined values are placed after non-undefined values.
1257 // Returns the number of non-undefined values. 1256 // Returns the number of non-undefined values.
1258 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit); 1257 MUST_USE_RESULT MaybeObject* PrepareElementsForSort(uint32_t limit);
1259 // As PrepareElementsForSort, but only on objects where elements is 1258 // As PrepareElementsForSort, but only on objects where elements is
1260 // a dictionary, and it will stay a dictionary. 1259 // a dictionary, and it will stay a dictionary.
1261 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit); 1260 MUST_USE_RESULT MaybeObject* PrepareSlowElementsForSort(uint32_t limit);
1262 1261
1263 MUST_USE_RESULT MaybeObject* SetProperty(String* key, 1262 MUST_USE_RESULT MaybeObject* SetProperty(String* key,
1264 Object* value, 1263 Object* value,
1265 PropertyAttributes attributes); 1264 PropertyAttributes attributes,
1265 StrictModeFlag strict_mode);
1266 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result, 1266 MUST_USE_RESULT MaybeObject* SetProperty(LookupResult* result,
1267 String* key, 1267 String* key,
1268 Object* value, 1268 Object* value,
1269 PropertyAttributes attributes); 1269 PropertyAttributes attributes,
1270 StrictModeFlag strict_mode);
1270 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck( 1271 MUST_USE_RESULT MaybeObject* SetPropertyWithFailedAccessCheck(
1271 LookupResult* result, 1272 LookupResult* result,
1272 String* name, 1273 String* name,
1273 Object* value, 1274 Object* value,
1274 bool check_prototype); 1275 bool check_prototype);
1275 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(Object* structure, 1276 MUST_USE_RESULT MaybeObject* SetPropertyWithCallback(Object* structure,
1276 String* name, 1277 String* name,
1277 Object* value, 1278 Object* value,
1278 JSObject* holder); 1279 JSObject* holder);
1279 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter, 1280 MUST_USE_RESULT MaybeObject* SetPropertyWithDefinedSetter(JSFunction* setter,
1280 Object* value); 1281 Object* value);
1281 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor( 1282 MUST_USE_RESULT MaybeObject* SetPropertyWithInterceptor(
1282 String* name, 1283 String* name,
1283 Object* value, 1284 Object* value,
1284 PropertyAttributes attributes); 1285 PropertyAttributes attributes,
1286 StrictModeFlag strict_mode);
1285 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor( 1287 MUST_USE_RESULT MaybeObject* SetPropertyPostInterceptor(
1286 String* name, 1288 String* name,
1287 Object* value, 1289 Object* value,
1288 PropertyAttributes attributes); 1290 PropertyAttributes attributes,
1291 StrictModeFlag strict_mode);
1289 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes( 1292 MUST_USE_RESULT MaybeObject* SetLocalPropertyIgnoreAttributes(
1290 String* key, 1293 String* key,
1291 Object* value, 1294 Object* value,
1292 PropertyAttributes attributes); 1295 PropertyAttributes attributes);
1293 1296
1294 // Retrieve a value in a normalized object given a lookup result. 1297 // Retrieve a value in a normalized object given a lookup result.
1295 // Handles the special representation of JS global objects. 1298 // Handles the special representation of JS global objects.
1296 Object* GetNormalizedProperty(LookupResult* result); 1299 Object* GetNormalizedProperty(LookupResult* result);
1297 1300
1298 // Sets the property value in a normalized object given a lookup result. 1301 // Sets the property value in a normalized object given a lookup result.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1405 inline Object* GetPrototype(); 1408 inline Object* GetPrototype();
1406 1409
1407 // Set the object's prototype (only JSObject and null are allowed). 1410 // Set the object's prototype (only JSObject and null are allowed).
1408 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value, 1411 MUST_USE_RESULT MaybeObject* SetPrototype(Object* value,
1409 bool skip_hidden_prototypes); 1412 bool skip_hidden_prototypes);
1410 1413
1411 // Tells whether the index'th element is present. 1414 // Tells whether the index'th element is present.
1412 inline bool HasElement(uint32_t index); 1415 inline bool HasElement(uint32_t index);
1413 bool HasElementWithReceiver(JSObject* receiver, uint32_t index); 1416 bool HasElementWithReceiver(JSObject* receiver, uint32_t index);
1414 1417
1418 // Computes the new capacity when expanding the elements of a JSObject.
1419 static int NewElementsCapacity(int old_capacity) {
1420 // (old_capacity + 50%) + 16
1421 return old_capacity + (old_capacity >> 1) + 16;
1422 }
1423
1415 // Tells whether the index'th element is present and how it is stored. 1424 // Tells whether the index'th element is present and how it is stored.
1416 enum LocalElementType { 1425 enum LocalElementType {
1417 // There is no element with given index. 1426 // There is no element with given index.
1418 UNDEFINED_ELEMENT, 1427 UNDEFINED_ELEMENT,
1419 1428
1420 // Element with given index is handled by interceptor. 1429 // Element with given index is handled by interceptor.
1421 INTERCEPTED_ELEMENT, 1430 INTERCEPTED_ELEMENT,
1422 1431
1423 // Element with given index is character in string. 1432 // Element with given index is character in string.
1424 STRING_CHARACTER_ELEMENT, 1433 STRING_CHARACTER_ELEMENT,
1425 1434
1426 // Element with given index is stored in fast backing store. 1435 // Element with given index is stored in fast backing store.
1427 FAST_ELEMENT, 1436 FAST_ELEMENT,
1428 1437
1429 // Element with given index is stored in slow backing store. 1438 // Element with given index is stored in slow backing store.
1430 DICTIONARY_ELEMENT 1439 DICTIONARY_ELEMENT
1431 }; 1440 };
1432 1441
1433 LocalElementType HasLocalElement(uint32_t index); 1442 LocalElementType HasLocalElement(uint32_t index);
1434 1443
1435 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index); 1444 bool HasElementWithInterceptor(JSObject* receiver, uint32_t index);
1436 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index); 1445 bool HasElementPostInterceptor(JSObject* receiver, uint32_t index);
1437 1446
1438 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index, 1447 MUST_USE_RESULT MaybeObject* SetFastElement(uint32_t index,
1439 Object* value, 1448 Object* value,
1449 StrictModeFlag strict_mode,
1440 bool check_prototype = true); 1450 bool check_prototype = true);
1441 1451
1442 // Set the index'th array element. 1452 // Set the index'th array element.
1443 // A Failure object is returned if GC is needed. 1453 // A Failure object is returned if GC is needed.
1444 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index, 1454 MUST_USE_RESULT MaybeObject* SetElement(uint32_t index,
1445 Object* value, 1455 Object* value,
1456 StrictModeFlag strict_mode,
1446 bool check_prototype = true); 1457 bool check_prototype = true);
1447 1458
1448 // Returns the index'th element. 1459 // Returns the index'th element.
1449 // The undefined object if index is out of bounds. 1460 // The undefined object if index is out of bounds.
1450 MaybeObject* GetElementWithReceiver(JSObject* receiver, uint32_t index); 1461 MaybeObject* GetElementWithReceiver(Object* receiver, uint32_t index);
1451 MaybeObject* GetElementWithInterceptor(JSObject* receiver, uint32_t index); 1462 MaybeObject* GetElementWithInterceptor(Object* receiver, uint32_t index);
1463
1464 // Get external element value at index if there is one and undefined
1465 // otherwise. Can return a failure if allocation of a heap number
1466 // failed.
1467 MaybeObject* GetExternalElement(uint32_t index);
1452 1468
1453 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity, 1469 MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength(int capacity,
1454 int length); 1470 int length);
1455 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length); 1471 MUST_USE_RESULT MaybeObject* SetSlowElements(Object* length);
1456 1472
1457 // Lookup interceptors are used for handling properties controlled by host 1473 // Lookup interceptors are used for handling properties controlled by host
1458 // objects. 1474 // objects.
1459 inline bool HasNamedInterceptor(); 1475 inline bool HasNamedInterceptor();
1460 inline bool HasIndexedInterceptor(); 1476 inline bool HasIndexedInterceptor();
1461 1477
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 1706
1691 private: 1707 private:
1692 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver, 1708 MUST_USE_RESULT MaybeObject* GetElementWithCallback(Object* receiver,
1693 Object* structure, 1709 Object* structure,
1694 uint32_t index, 1710 uint32_t index,
1695 Object* holder); 1711 Object* holder);
1696 MaybeObject* SetElementWithCallback(Object* structure, 1712 MaybeObject* SetElementWithCallback(Object* structure,
1697 uint32_t index, 1713 uint32_t index,
1698 Object* value, 1714 Object* value,
1699 JSObject* holder); 1715 JSObject* holder);
1700 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(uint32_t index, 1716 MUST_USE_RESULT MaybeObject* SetElementWithInterceptor(
1701 Object* value, 1717 uint32_t index,
1702 bool check_prototype); 1718 Object* value,
1719 StrictModeFlag strict_mode,
1720 bool check_prototype);
1703 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor( 1721 MUST_USE_RESULT MaybeObject* SetElementWithoutInterceptor(
1704 uint32_t index, 1722 uint32_t index,
1705 Object* value, 1723 Object* value,
1724 StrictModeFlag strict_mode,
1706 bool check_prototype); 1725 bool check_prototype);
1707 1726
1708 MaybeObject* GetElementPostInterceptor(JSObject* receiver, uint32_t index); 1727 MaybeObject* GetElementPostInterceptor(Object* receiver, uint32_t index);
1709 1728
1710 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name, 1729 MUST_USE_RESULT MaybeObject* DeletePropertyPostInterceptor(String* name,
1711 DeleteMode mode); 1730 DeleteMode mode);
1712 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name); 1731 MUST_USE_RESULT MaybeObject* DeletePropertyWithInterceptor(String* name);
1713 1732
1714 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index, 1733 MUST_USE_RESULT MaybeObject* DeleteElementPostInterceptor(uint32_t index,
1715 DeleteMode mode); 1734 DeleteMode mode);
1716 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index); 1735 MUST_USE_RESULT MaybeObject* DeleteElementWithInterceptor(uint32_t index);
1717 1736
1718 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver, 1737 PropertyAttributes GetPropertyAttributePostInterceptor(JSObject* receiver,
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 static inline Dictionary<Shape, Key>* cast(Object* obj) { 2351 static inline Dictionary<Shape, Key>* cast(Object* obj) {
2333 return reinterpret_cast<Dictionary<Shape, Key>*>(obj); 2352 return reinterpret_cast<Dictionary<Shape, Key>*>(obj);
2334 } 2353 }
2335 2354
2336 // Returns the value at entry. 2355 // Returns the value at entry.
2337 Object* ValueAt(int entry) { 2356 Object* ValueAt(int entry) {
2338 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1); 2357 return this->get(HashTable<Shape, Key>::EntryToIndex(entry)+1);
2339 } 2358 }
2340 2359
2341 // Set the value for entry. 2360 // Set the value for entry.
2342 void ValueAtPut(int entry, Object* value) { 2361 // Returns false if the put wasn't performed due to property being read only.
2362 // Returns true on successful put.
2363 bool ValueAtPut(int entry, Object* value) {
2343 // Check that this value can actually be written. 2364 // Check that this value can actually be written.
2344 PropertyDetails details = DetailsAt(entry); 2365 PropertyDetails details = DetailsAt(entry);
2345 // If a value has not been initilized we allow writing to it even if 2366 // If a value has not been initilized we allow writing to it even if
2346 // it is read only (a declared const that has not been initialized). 2367 // it is read only (a declared const that has not been initialized).
2347 if (details.IsReadOnly() && !ValueAt(entry)->IsTheHole()) return; 2368 if (details.IsReadOnly() && !ValueAt(entry)->IsTheHole()) {
2348 this->set(HashTable<Shape, Key>::EntryToIndex(entry)+1, value); 2369 return false;
2370 }
2371 this->set(HashTable<Shape, Key>::EntryToIndex(entry) + 1, value);
2372 return true;
2349 } 2373 }
2350 2374
2351 // Returns the property details for the property at entry. 2375 // Returns the property details for the property at entry.
2352 PropertyDetails DetailsAt(int entry) { 2376 PropertyDetails DetailsAt(int entry) {
2353 ASSERT(entry >= 0); // Not found is -1, which is not caught by get(). 2377 ASSERT(entry >= 0); // Not found is -1, which is not caught by get().
2354 return PropertyDetails( 2378 return PropertyDetails(
2355 Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 2))); 2379 Smi::cast(this->get(HashTable<Shape, Key>::EntryToIndex(entry) + 2)));
2356 } 2380 }
2357 2381
2358 // Set the details for entry. 2382 // Set the details for entry.
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 // Maximal memory consumption for a single ByteArray. 2668 // Maximal memory consumption for a single ByteArray.
2645 static const int kMaxSize = 512 * MB; 2669 static const int kMaxSize = 512 * MB;
2646 // Maximal length of a single ByteArray. 2670 // Maximal length of a single ByteArray.
2647 static const int kMaxLength = kMaxSize - kHeaderSize; 2671 static const int kMaxLength = kMaxSize - kHeaderSize;
2648 2672
2649 private: 2673 private:
2650 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray); 2674 DISALLOW_IMPLICIT_CONSTRUCTORS(ByteArray);
2651 }; 2675 };
2652 2676
2653 2677
2654 // A PixelArray represents a fixed-size byte array with special semantics
2655 // used for implementing the CanvasPixelArray object. Please see the
2656 // specification at:
2657 // http://www.whatwg.org/specs/web-apps/current-work/
2658 // multipage/the-canvas-element.html#canvaspixelarray
2659 // In particular, write access clamps the value written to 0 or 255 if the
2660 // value written is outside this range.
2661 class PixelArray: public HeapObject {
2662 public:
2663 // [length]: length of the array.
2664 inline int length();
2665 inline void set_length(int value);
2666
2667 // [external_pointer]: The pointer to the external memory area backing this
2668 // pixel array.
2669 DECL_ACCESSORS(external_pointer, uint8_t) // Pointer to the data store.
2670
2671 // Setter and getter.
2672 inline uint8_t get(int index);
2673 inline void set(int index, uint8_t value);
2674
2675 // This accessor applies the correct conversion from Smi, HeapNumber and
2676 // undefined and clamps the converted value between 0 and 255.
2677 Object* SetValue(uint32_t index, Object* value);
2678
2679 // Casting.
2680 static inline PixelArray* cast(Object* obj);
2681
2682 #ifdef OBJECT_PRINT
2683 inline void PixelArrayPrint() {
2684 PixelArrayPrint(stdout);
2685 }
2686 void PixelArrayPrint(FILE* out);
2687 #endif
2688 #ifdef DEBUG
2689 void PixelArrayVerify();
2690 #endif // DEBUG
2691
2692 // Maximal acceptable length for a pixel array.
2693 static const int kMaxLength = 0x3fffffff;
2694
2695 // PixelArray headers are not quadword aligned.
2696 static const int kLengthOffset = HeapObject::kHeaderSize;
2697 static const int kExternalPointerOffset =
2698 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize);
2699 static const int kHeaderSize = kExternalPointerOffset + kPointerSize;
2700 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
2701
2702 private:
2703 DISALLOW_IMPLICIT_CONSTRUCTORS(PixelArray);
2704 };
2705
2706
2707 // An ExternalArray represents a fixed-size array of primitive values 2678 // An ExternalArray represents a fixed-size array of primitive values
2708 // which live outside the JavaScript heap. Its subclasses are used to 2679 // which live outside the JavaScript heap. Its subclasses are used to
2709 // implement the CanvasArray types being defined in the WebGL 2680 // implement the CanvasArray types being defined in the WebGL
2710 // specification. As of this writing the first public draft is not yet 2681 // specification. As of this writing the first public draft is not yet
2711 // available, but Khronos members can access the draft at: 2682 // available, but Khronos members can access the draft at:
2712 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html 2683 // https://cvs.khronos.org/svn/repos/3dweb/trunk/doc/spec/WebGL-spec.html
2713 // 2684 //
2714 // The semantics of these arrays differ from CanvasPixelArray. 2685 // The semantics of these arrays differ from CanvasPixelArray.
2715 // Out-of-range values passed to the setter are converted via a C 2686 // Out-of-range values passed to the setter are converted via a C
2716 // cast, not clamping. Out-of-range indices cause exceptions to be 2687 // cast, not clamping. Out-of-range indices cause exceptions to be
(...skipping 19 matching lines...) Expand all
2736 static const int kExternalPointerOffset = 2707 static const int kExternalPointerOffset =
2737 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize); 2708 POINTER_SIZE_ALIGN(kLengthOffset + kIntSize);
2738 static const int kHeaderSize = kExternalPointerOffset + kPointerSize; 2709 static const int kHeaderSize = kExternalPointerOffset + kPointerSize;
2739 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize); 2710 static const int kAlignedSize = OBJECT_POINTER_ALIGN(kHeaderSize);
2740 2711
2741 private: 2712 private:
2742 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray); 2713 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalArray);
2743 }; 2714 };
2744 2715
2745 2716
2717 // A ExternalPixelArray represents a fixed-size byte array with special
2718 // semantics used for implementing the CanvasPixelArray object. Please see the
2719 // specification at:
2720
2721 // http://www.whatwg.org/specs/web-apps/current-work/
2722 // multipage/the-canvas-element.html#canvaspixelarray
2723 // In particular, write access clamps the value written to 0 or 255 if the
2724 // value written is outside this range.
2725 class ExternalPixelArray: public ExternalArray {
2726 public:
2727 inline uint8_t* external_pixel_pointer();
2728
2729 // Setter and getter.
2730 inline uint8_t get(int index);
2731 inline void set(int index, uint8_t value);
2732
2733 // This accessor applies the correct conversion from Smi, HeapNumber and
2734 // undefined and clamps the converted value between 0 and 255.
2735 Object* SetValue(uint32_t index, Object* value);
2736
2737 // Casting.
2738 static inline ExternalPixelArray* cast(Object* obj);
2739
2740 #ifdef OBJECT_PRINT
2741 inline void ExternalPixelArrayPrint() {
2742 ExternalPixelArrayPrint(stdout);
2743 }
2744 void ExternalPixelArrayPrint(FILE* out);
2745 #endif
2746 #ifdef DEBUG
2747 void ExternalPixelArrayVerify();
2748 #endif // DEBUG
2749
2750 private:
2751 DISALLOW_IMPLICIT_CONSTRUCTORS(ExternalPixelArray);
2752 };
2753
2754
2746 class ExternalByteArray: public ExternalArray { 2755 class ExternalByteArray: public ExternalArray {
2747 public: 2756 public:
2748 // Setter and getter. 2757 // Setter and getter.
2749 inline int8_t get(int index); 2758 inline int8_t get(int index);
2750 inline void set(int index, int8_t value); 2759 inline void set(int index, int8_t value);
2751 2760
2752 // This accessor applies the correct conversion from Smi, HeapNumber 2761 // This accessor applies the correct conversion from Smi, HeapNumber
2753 // and undefined. 2762 // and undefined.
2754 MaybeObject* SetValue(uint32_t index, Object* value); 2763 MaybeObject* SetValue(uint32_t index, Object* value);
2755 2764
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 FLAGS_MAX_VALUE = kMaxInt 3079 FLAGS_MAX_VALUE = kMaxInt
3071 }; 3080 };
3072 3081
3073 enum Kind { 3082 enum Kind {
3074 FUNCTION, 3083 FUNCTION,
3075 OPTIMIZED_FUNCTION, 3084 OPTIMIZED_FUNCTION,
3076 STUB, 3085 STUB,
3077 BUILTIN, 3086 BUILTIN,
3078 LOAD_IC, 3087 LOAD_IC,
3079 KEYED_LOAD_IC, 3088 KEYED_LOAD_IC,
3089 KEYED_EXTERNAL_ARRAY_LOAD_IC,
3080 CALL_IC, 3090 CALL_IC,
3081 KEYED_CALL_IC, 3091 KEYED_CALL_IC,
3082 STORE_IC, 3092 STORE_IC,
3083 KEYED_STORE_IC, 3093 KEYED_STORE_IC,
3094 KEYED_EXTERNAL_ARRAY_STORE_IC,
3084 BINARY_OP_IC, 3095 BINARY_OP_IC,
3085 TYPE_RECORDING_BINARY_OP_IC, 3096 TYPE_RECORDING_BINARY_OP_IC,
3086 COMPARE_IC, 3097 COMPARE_IC,
3087 // No more than 16 kinds. The value currently encoded in four bits in 3098 // No more than 16 kinds. The value currently encoded in four bits in
3088 // Flags. 3099 // Flags.
3089 3100
3090 // Pseudo-kinds. 3101 // Pseudo-kinds.
3091 REGEXP = BUILTIN, 3102 REGEXP = BUILTIN,
3092 FIRST_IC_KIND = LOAD_IC, 3103 FIRST_IC_KIND = LOAD_IC,
3093 LAST_IC_KIND = COMPARE_IC 3104 LAST_IC_KIND = COMPARE_IC
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
3148 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; } 3159 inline bool is_keyed_load_stub() { return kind() == KEYED_LOAD_IC; }
3149 inline bool is_store_stub() { return kind() == STORE_IC; } 3160 inline bool is_store_stub() { return kind() == STORE_IC; }
3150 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; } 3161 inline bool is_keyed_store_stub() { return kind() == KEYED_STORE_IC; }
3151 inline bool is_call_stub() { return kind() == CALL_IC; } 3162 inline bool is_call_stub() { return kind() == CALL_IC; }
3152 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; } 3163 inline bool is_keyed_call_stub() { return kind() == KEYED_CALL_IC; }
3153 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; } 3164 inline bool is_binary_op_stub() { return kind() == BINARY_OP_IC; }
3154 inline bool is_type_recording_binary_op_stub() { 3165 inline bool is_type_recording_binary_op_stub() {
3155 return kind() == TYPE_RECORDING_BINARY_OP_IC; 3166 return kind() == TYPE_RECORDING_BINARY_OP_IC;
3156 } 3167 }
3157 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; } 3168 inline bool is_compare_ic_stub() { return kind() == COMPARE_IC; }
3169 inline bool is_external_array_load_stub() {
3170 return kind() == KEYED_EXTERNAL_ARRAY_LOAD_IC;
3171 }
3172 inline bool is_external_array_store_stub() {
3173 return kind() == KEYED_EXTERNAL_ARRAY_STORE_IC;
3174 }
3158 3175
3159 // [major_key]: For kind STUB or BINARY_OP_IC, the major key. 3176 // [major_key]: For kind STUB or BINARY_OP_IC, the major key.
3160 inline int major_key(); 3177 inline int major_key();
3161 inline void set_major_key(int value); 3178 inline void set_major_key(int value);
3162 3179
3163 // [optimizable]: For FUNCTION kind, tells if it is optimizable. 3180 // [optimizable]: For FUNCTION kind, tells if it is optimizable.
3164 inline bool optimizable(); 3181 inline bool optimizable();
3165 inline void set_optimizable(bool value); 3182 inline void set_optimizable(bool value);
3166 3183
3167 // [has_deoptimization_support]: For FUNCTION kind, tells if it has 3184 // [has_deoptimization_support]: For FUNCTION kind, tells if it has
(...skipping 21 matching lines...) Expand all
3189 // [stack_check_table_start]: For kind FUNCTION, the offset in the 3206 // [stack_check_table_start]: For kind FUNCTION, the offset in the
3190 // instruction stream where the stack check table starts. 3207 // instruction stream where the stack check table starts.
3191 inline unsigned stack_check_table_offset(); 3208 inline unsigned stack_check_table_offset();
3192 inline void set_stack_check_table_offset(unsigned offset); 3209 inline void set_stack_check_table_offset(unsigned offset);
3193 3210
3194 // [check type]: For kind CALL_IC, tells how to check if the 3211 // [check type]: For kind CALL_IC, tells how to check if the
3195 // receiver is valid for the given call. 3212 // receiver is valid for the given call.
3196 inline CheckType check_type(); 3213 inline CheckType check_type();
3197 inline void set_check_type(CheckType value); 3214 inline void set_check_type(CheckType value);
3198 3215
3216 // [external array type]: For kind KEYED_EXTERNAL_ARRAY_LOAD_IC and
3217 // KEYED_EXTERNAL_ARRAY_STORE_IC, identifies the type of external
3218 // array that the code stub is specialized for.
3219 inline ExternalArrayType external_array_type();
3220 inline void set_external_array_type(ExternalArrayType value);
3221
3199 // [binary op type]: For all BINARY_OP_IC. 3222 // [binary op type]: For all BINARY_OP_IC.
3200 inline byte binary_op_type(); 3223 inline byte binary_op_type();
3201 inline void set_binary_op_type(byte value); 3224 inline void set_binary_op_type(byte value);
3202 3225
3203 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC. 3226 // [type-recording binary op type]: For all TYPE_RECORDING_BINARY_OP_IC.
3204 inline byte type_recording_binary_op_type(); 3227 inline byte type_recording_binary_op_type();
3205 inline void set_type_recording_binary_op_type(byte value); 3228 inline void set_type_recording_binary_op_type(byte value);
3206 inline byte type_recording_binary_op_result_type(); 3229 inline byte type_recording_binary_op_result_type();
3207 inline void set_type_recording_binary_op_result_type(byte value); 3230 inline void set_type_recording_binary_op_result_type(byte value);
3208 3231
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 // Add padding to align the instruction start following right after 3360 // Add padding to align the instruction start following right after
3338 // the Code object header. 3361 // the Code object header.
3339 static const int kHeaderSize = 3362 static const int kHeaderSize =
3340 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask; 3363 (kHeaderPaddingStart + kCodeAlignmentMask) & ~kCodeAlignmentMask;
3341 3364
3342 // Byte offsets within kKindSpecificFlagsOffset. 3365 // Byte offsets within kKindSpecificFlagsOffset.
3343 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset; 3366 static const int kStubMajorKeyOffset = kKindSpecificFlagsOffset;
3344 static const int kOptimizableOffset = kKindSpecificFlagsOffset; 3367 static const int kOptimizableOffset = kKindSpecificFlagsOffset;
3345 static const int kStackSlotsOffset = kKindSpecificFlagsOffset; 3368 static const int kStackSlotsOffset = kKindSpecificFlagsOffset;
3346 static const int kCheckTypeOffset = kKindSpecificFlagsOffset; 3369 static const int kCheckTypeOffset = kKindSpecificFlagsOffset;
3370 static const int kExternalArrayTypeOffset = kKindSpecificFlagsOffset;
3347 3371
3348 static const int kCompareStateOffset = kStubMajorKeyOffset + 1; 3372 static const int kCompareStateOffset = kStubMajorKeyOffset + 1;
3349 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1; 3373 static const int kBinaryOpTypeOffset = kStubMajorKeyOffset + 1;
3350 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1; 3374 static const int kHasDeoptimizationSupportOffset = kOptimizableOffset + 1;
3351 3375
3352 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1; 3376 static const int kBinaryOpReturnTypeOffset = kBinaryOpTypeOffset + 1;
3353 static const int kAllowOSRAtLoopNestingLevelOffset = 3377 static const int kAllowOSRAtLoopNestingLevelOffset =
3354 kHasDeoptimizationSupportOffset + 1; 3378 kHasDeoptimizationSupportOffset + 1;
3355 3379
3356 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize; 3380 static const int kSafepointTableOffsetOffset = kStackSlotsOffset + kIntSize;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 } else { 3518 } else {
3495 set_bit_field2(bit_field2() & ~(1 << kHasFastElements)); 3519 set_bit_field2(bit_field2() & ~(1 << kHasFastElements));
3496 } 3520 }
3497 } 3521 }
3498 3522
3499 inline bool has_fast_elements() { 3523 inline bool has_fast_elements() {
3500 return ((1 << kHasFastElements) & bit_field2()) != 0; 3524 return ((1 << kHasFastElements) & bit_field2()) != 0;
3501 } 3525 }
3502 3526
3503 // Tells whether an instance has pixel array elements. 3527 // Tells whether an instance has pixel array elements.
3504 inline void set_has_pixel_array_elements(bool value) { 3528 inline void set_has_external_array_elements(bool value) {
3505 if (value) { 3529 if (value) {
3506 set_bit_field2(bit_field2() | (1 << kHasPixelArrayElements)); 3530 set_bit_field2(bit_field2() | (1 << kHasExternalArrayElements));
3507 } else { 3531 } else {
3508 set_bit_field2(bit_field2() & ~(1 << kHasPixelArrayElements)); 3532 set_bit_field2(bit_field2() & ~(1 << kHasExternalArrayElements));
3509 } 3533 }
3510 } 3534 }
3511 3535
3512 inline bool has_pixel_array_elements() { 3536 inline bool has_external_array_elements() {
3513 return ((1 << kHasPixelArrayElements) & bit_field2()) != 0; 3537 return ((1 << kHasExternalArrayElements) & bit_field2()) != 0;
3514 } 3538 }
3515 3539
3516 // Tells whether the map is attached to SharedFunctionInfo 3540 // Tells whether the map is attached to SharedFunctionInfo
3517 // (for inobject slack tracking). 3541 // (for inobject slack tracking).
3518 inline void set_attached_to_shared_function_info(bool value); 3542 inline void set_attached_to_shared_function_info(bool value);
3519 3543
3520 inline bool attached_to_shared_function_info(); 3544 inline bool attached_to_shared_function_info();
3521 3545
3522 // Tells whether the map is shared between objects that may have different 3546 // Tells whether the map is shared between objects that may have different
3523 // behavior. If true, the map should never be modified, instead a clone 3547 // behavior. If true, the map should never be modified, instead a clone
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
3564 // Returns this map if it has the fast elements bit set, otherwise 3588 // Returns this map if it has the fast elements bit set, otherwise
3565 // returns a copy of the map, with all transitions dropped from the 3589 // returns a copy of the map, with all transitions dropped from the
3566 // descriptors and the fast elements bit set. 3590 // descriptors and the fast elements bit set.
3567 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap(); 3591 MUST_USE_RESULT inline MaybeObject* GetFastElementsMap();
3568 3592
3569 // Returns this map if it has the fast elements bit cleared, 3593 // Returns this map if it has the fast elements bit cleared,
3570 // otherwise returns a copy of the map, with all transitions dropped 3594 // otherwise returns a copy of the map, with all transitions dropped
3571 // from the descriptors and the fast elements bit cleared. 3595 // from the descriptors and the fast elements bit cleared.
3572 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap(); 3596 MUST_USE_RESULT inline MaybeObject* GetSlowElementsMap();
3573 3597
3574 // Returns this map if it has the pixel array elements bit is set, otherwise 3598 // Returns a new map with all transitions dropped from the descriptors and the
3575 // returns a copy of the map, with all transitions dropped from the 3599 // external array elements bit set.
3576 // descriptors and the pixel array elements bit set. 3600 MUST_USE_RESULT inline MaybeObject* NewExternalArrayElementsMap();
3577 MUST_USE_RESULT inline MaybeObject* GetPixelArrayElementsMap();
3578 3601
3579 // Returns the property index for name (only valid for FAST MODE). 3602 // Returns the property index for name (only valid for FAST MODE).
3580 int PropertyIndexFor(String* name); 3603 int PropertyIndexFor(String* name);
3581 3604
3582 // Returns the next free property index (only valid for FAST MODE). 3605 // Returns the next free property index (only valid for FAST MODE).
3583 int NextFreePropertyIndex(); 3606 int NextFreePropertyIndex();
3584 3607
3585 // Returns the number of properties described in instance_descriptors. 3608 // Returns the number of properties described in instance_descriptors.
3586 int NumberOfDescribedProperties(); 3609 int NumberOfDescribedProperties();
3587 3610
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
3687 static const int kHasInstanceCallHandler = 6; 3710 static const int kHasInstanceCallHandler = 6;
3688 static const int kIsAccessCheckNeeded = 7; 3711 static const int kIsAccessCheckNeeded = 7;
3689 3712
3690 // Bit positions for bit field 2 3713 // Bit positions for bit field 2
3691 static const int kIsExtensible = 0; 3714 static const int kIsExtensible = 0;
3692 static const int kFunctionWithPrototype = 1; 3715 static const int kFunctionWithPrototype = 1;
3693 static const int kHasFastElements = 2; 3716 static const int kHasFastElements = 2;
3694 static const int kStringWrapperSafeForDefaultValueOf = 3; 3717 static const int kStringWrapperSafeForDefaultValueOf = 3;
3695 static const int kAttachedToSharedFunctionInfo = 4; 3718 static const int kAttachedToSharedFunctionInfo = 4;
3696 static const int kIsShared = 5; 3719 static const int kIsShared = 5;
3697 static const int kHasPixelArrayElements = 6; 3720 static const int kHasExternalArrayElements = 6;
3698 3721
3699 // Layout of the default cache. It holds alternating name and code objects. 3722 // Layout of the default cache. It holds alternating name and code objects.
3700 static const int kCodeCacheEntrySize = 2; 3723 static const int kCodeCacheEntrySize = 2;
3701 static const int kCodeCacheEntryNameOffset = 0; 3724 static const int kCodeCacheEntryNameOffset = 0;
3702 static const int kCodeCacheEntryCodeOffset = 1; 3725 static const int kCodeCacheEntryCodeOffset = 1;
3703 3726
3704 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset, 3727 typedef FixedBodyDescriptor<kPointerFieldsBeginOffset,
3705 kPointerFieldsEndOffset, 3728 kPointerFieldsEndOffset,
3706 kSize> BodyDescriptor; 3729 kSize> BodyDescriptor;
3707 3730
(...skipping 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after
5025 int length_; 5048 int length_;
5026 uint32_t raw_running_hash_; 5049 uint32_t raw_running_hash_;
5027 uint32_t array_index_; 5050 uint32_t array_index_;
5028 bool is_array_index_; 5051 bool is_array_index_;
5029 bool is_first_char_; 5052 bool is_first_char_;
5030 bool is_valid_; 5053 bool is_valid_;
5031 friend class TwoCharHashTableKey; 5054 friend class TwoCharHashTableKey;
5032 }; 5055 };
5033 5056
5034 5057
5058 // Calculates string hash.
5059 template <typename schar>
5060 inline uint32_t HashSequentialString(const schar* chars, int length);
5061
5062
5035 // The characteristics of a string are stored in its map. Retrieving these 5063 // The characteristics of a string are stored in its map. Retrieving these
5036 // few bits of information is moderately expensive, involving two memory 5064 // few bits of information is moderately expensive, involving two memory
5037 // loads where the second is dependent on the first. To improve efficiency 5065 // loads where the second is dependent on the first. To improve efficiency
5038 // the shape of the string is given its own class so that it can be retrieved 5066 // the shape of the string is given its own class so that it can be retrieved
5039 // once and used for several string operations. A StringShape is small enough 5067 // once and used for several string operations. A StringShape is small enough
5040 // to be passed by value and is immutable, but be aware that flattening a 5068 // to be passed by value and is immutable, but be aware that flattening a
5041 // string can potentially alter its shape. Also be aware that a GC caused by 5069 // string can potentially alter its shape. Also be aware that a GC caused by
5042 // something else can alter the shape of a string due to ConsString 5070 // something else can alter the shape of a string due to ConsString
5043 // shortcutting. Keeping these restrictions in mind has proven to be error- 5071 // shortcutting. Keeping these restrictions in mind has proven to be error-
5044 // prone and so we no longer put StringShapes in variables unless there is a 5072 // prone and so we no longer put StringShapes in variables unless there is a
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
6406 6434
6407 // Visits a contiguous arrays of external references (references to the C++ 6435 // Visits a contiguous arrays of external references (references to the C++
6408 // heap) in the half-open range [start, end). Any or all of the values 6436 // heap) in the half-open range [start, end). Any or all of the values
6409 // may be modified on return. 6437 // may be modified on return.
6410 virtual void VisitExternalReferences(Address* start, Address* end) {} 6438 virtual void VisitExternalReferences(Address* start, Address* end) {}
6411 6439
6412 inline void VisitExternalReference(Address* p) { 6440 inline void VisitExternalReference(Address* p) {
6413 VisitExternalReferences(p, p + 1); 6441 VisitExternalReferences(p, p + 1);
6414 } 6442 }
6415 6443
6444 // Visits a handle that has an embedder-assigned class ID.
6445 virtual void VisitEmbedderReference(Object** p, uint16_t class_id) {}
6446
6416 #ifdef DEBUG 6447 #ifdef DEBUG
6417 // Intended for serialization/deserialization checking: insert, or 6448 // Intended for serialization/deserialization checking: insert, or
6418 // check for the presence of, a tag at this position in the stream. 6449 // check for the presence of, a tag at this position in the stream.
6419 virtual void Synchronize(const char* tag) {} 6450 virtual void Synchronize(const char* tag) {}
6420 #else 6451 #else
6421 inline void Synchronize(const char* tag) {} 6452 inline void Synchronize(const char* tag) {}
6422 #endif 6453 #endif
6423 }; 6454 };
6424 6455
6425 6456
(...skipping 28 matching lines...) Expand all
6454 } else { 6485 } else {
6455 value &= ~(1 << bit_position); 6486 value &= ~(1 << bit_position);
6456 } 6487 }
6457 return value; 6488 return value;
6458 } 6489 }
6459 }; 6490 };
6460 6491
6461 } } // namespace v8::internal 6492 } } // namespace v8::internal
6462 6493
6463 #endif // V8_OBJECTS_H_ 6494 #endif // V8_OBJECTS_H_
OLDNEW
« no previous file with comments | « src/messages.js ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698