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

Side by Side Diff: src/macros.py

Issue 947683002: Reimplement Maps and Sets in JS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rename all the things, add more macros, and remove unnecessary %_CallFunctions Created 5 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
OLDNEW
1 # Copyright 2006-2009 the V8 project authors. All rights reserved. 1 # Copyright 2006-2009 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 const PROPERTY_ATTRIBUTES_NONE = 0; 264 const PROPERTY_ATTRIBUTES_NONE = 0;
265 const PROPERTY_ATTRIBUTES_STRING = 8; 265 const PROPERTY_ATTRIBUTES_STRING = 8;
266 const PROPERTY_ATTRIBUTES_SYMBOLIC = 16; 266 const PROPERTY_ATTRIBUTES_SYMBOLIC = 16;
267 const PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32; 267 const PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL = 32;
268 268
269 # Use for keys, values and entries iterators. 269 # Use for keys, values and entries iterators.
270 const ITERATOR_KIND_KEYS = 1; 270 const ITERATOR_KIND_KEYS = 1;
271 const ITERATOR_KIND_VALUES = 2; 271 const ITERATOR_KIND_VALUES = 2;
272 const ITERATOR_KIND_ENTRIES = 3; 272 const ITERATOR_KIND_ENTRIES = 3;
273 273
274 macro FIXED_ARRAY_GET(array, index) = (%_FixedArrayGet(array, (index) | 0));
275 macro FIXED_ARRAY_SET(array, index, value) = (%_FixedArraySet(array, (index) | 0 , value));
276 # TODO(adamk): Find a more robust way to force Smi representation.
277 macro FIXED_ARRAY_SET_SMI(array, index, value) = (FIXED_ARRAY_SET(array, index, (value) | 0));
278
279 macro ORDERED_HASH_TABLE_BUCKET_COUNT(table) = (FIXED_ARRAY_GET(table, 0));
280 macro ORDERED_HASH_TABLE_ELEMENT_COUNT(table) = (FIXED_ARRAY_GET(table, 1));
281 macro ORDERED_HASH_TABLE_SET_ELEMENT_COUNT(table, count) = (FIXED_ARRAY_SET_SMI( table, 1, count));
282 macro ORDERED_HASH_TABLE_DELETED_COUNT(table) = (FIXED_ARRAY_GET(table, 2));
283 macro ORDERED_HASH_TABLE_SET_DELETED_COUNT(table, count) = (FIXED_ARRAY_SET_SMI( table, 2, count));
284 macro ORDERED_HASH_TABLE_BUCKET_AT(table, bucket) = (FIXED_ARRAY_GET(table, 3 + (bucket)));
285 macro ORDERED_HASH_TABLE_SET_BUCKET_AT(table, bucket, entry) = (FIXED_ARRAY_SET( table, 3 + (bucket), entry));
286
287 macro ORDERED_HASH_TABLE_HASH_TO_BUCKET(hash, numBuckets) = (hash & ((numBuckets ) - 1));
288
289 macro ORDERED_HASH_SET_ENTRY_TO_INDEX(entry, numBuckets) = (3 + (numBuckets) + ( (entry) << 1));
290 macro ORDERED_HASH_SET_KEY_AT(table, entry, numBuckets) = (FIXED_ARRAY_GET(table , ORDERED_HASH_SET_ENTRY_TO_INDEX(entry, numBuckets)));
291 macro ORDERED_HASH_SET_CHAIN_AT(table, entry, numBuckets) = (FIXED_ARRAY_GET(tab le, ORDERED_HASH_SET_ENTRY_TO_INDEX(entry, numBuckets) + 1));
292
293 macro ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets) = (3 + (numBuckets) + ( (entry) * 3));
294 macro ORDERED_HASH_MAP_KEY_AT(table, entry, numBuckets) = (FIXED_ARRAY_GET(table , ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets)));
295 macro ORDERED_HASH_MAP_VALUE_AT(table, entry, numBuckets) = (FIXED_ARRAY_GET(tab le, ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets) + 1));
296 macro ORDERED_HASH_MAP_CHAIN_AT(table, entry, numBuckets) = (FIXED_ARRAY_GET(tab le, ORDERED_HASH_MAP_ENTRY_TO_INDEX(entry, numBuckets) + 2));
297
298 # Must match OrderedHashTable::kNotFound.
299 const NOT_FOUND = -1;
300
274 # Check whether debug is active. 301 # Check whether debug is active.
275 const DEBUG_IS_ACTIVE = (%_DebugIsActive() != 0); 302 const DEBUG_IS_ACTIVE = (%_DebugIsActive() != 0);
276 macro DEBUG_IS_STEPPING(function) = (%_DebugIsActive() != 0 && %DebugCallbackSup portsStepping(function)); 303 macro DEBUG_IS_STEPPING(function) = (%_DebugIsActive() != 0 && %DebugCallbackSup portsStepping(function));
277 macro DEBUG_PREPARE_STEP_IN_IF_STEPPING(function) = if (DEBUG_IS_STEPPING(functi on)) %DebugPrepareStepInIfStepping(function); 304 macro DEBUG_PREPARE_STEP_IN_IF_STEPPING(function) = if (DEBUG_IS_STEPPING(functi on)) %DebugPrepareStepInIfStepping(function);
OLDNEW
« src/hydrogen.cc ('K') | « src/ia32/code-stubs-ia32.cc ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698