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

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: Moved more to JS 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 # Needs prefixing
275 const NUMBER_OF_BUCKETS_INDEX = 0;
276 const NUMBER_OF_ELEMENTS_INDEX = 1;
277 const NUMBER_OF_DELETED_ELEMENTS_INDEX = 2;
278 const HASH_TABLE_START_INDEX = 3;
279 const NOT_FOUND = -1;
280 const HASH_NOT_COMPUTED_MASK = 1;
281 const STRING_HASH_SHIFT = 2;
282 # For sets
283 const SET_CHAIN_OFFSET = 1;
284 const MAP_CHAIN_OFFSET = 2;
285
286 macro SET_ENTRY_TO_INDEX(entry, numBuckets) = (3 + numBuckets + (entry << 1));
287 macro SET_KEY_AT(table, entry, numBuckets) = (%_FixedArrayGet(table, SET_ENTRY_T O_INDEX(entry, numBuckets)));
288 macro SET_CHAIN_AT(table, entry, numBuckets) = (%_FixedArrayGet(table, SET_ENTRY _TO_INDEX(entry, numBuckets) + 1));
289
290 # TODO(adamk): Need to make multiplications not create HeapNumbers
291 macro MAP_ENTRY_TO_INDEX(entry, numBuckets) = (3 + numBuckets + ((entry * 3) | 0 ));
292 macro MAP_KEY_AT(table, entry, numBuckets) = (%_FixedArrayGet(table, MAP_ENTRY_T O_INDEX(entry, numBuckets)));
293 macro MAP_VALUE_AT(table, entry, numBuckets) = (%_FixedArrayGet(table, MAP_ENTRY _TO_INDEX(entry, numBuckets) + 1));
294 macro MAP_CHAIN_AT(table, entry, numBuckets) = (%_FixedArrayGet(table, MAP_ENTRY _TO_INDEX(entry, numBuckets) + 2));
295
274 # Check whether debug is active. 296 # Check whether debug is active.
275 const DEBUG_IS_ACTIVE = (%_DebugIsActive() != 0); 297 const DEBUG_IS_ACTIVE = (%_DebugIsActive() != 0);
276 macro DEBUG_IS_STEPPING(function) = (%_DebugIsActive() != 0 && %DebugCallbackSup portsStepping(function)); 298 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); 299 macro DEBUG_PREPARE_STEP_IN_IF_STEPPING(function) = if (DEBUG_IS_STEPPING(functi on)) %DebugPrepareStepInIfStepping(function);
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/objects.h » ('j') | src/runtime/runtime-collections.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698