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

Unified Diff: src/harmony-atomics.js

Issue 1398733002: Move builtin JavaScript sources into own directory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also move macros.py file. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/harmony-array-includes.js ('k') | src/harmony-concat-spreadable.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/harmony-atomics.js
diff --git a/src/harmony-atomics.js b/src/harmony-atomics.js
deleted file mode 100644
index 7412494e30368e9e984174f72b642aa97ed3f7d7..0000000000000000000000000000000000000000
--- a/src/harmony-atomics.js
+++ /dev/null
@@ -1,213 +0,0 @@
-// Copyright 2015 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-(function(global, utils) {
-
-"use strict";
-
-%CheckIsBootstrapping();
-
-// -------------------------------------------------------------------
-// Imports
-
-var GlobalObject = global.Object;
-var MathMax;
-var toStringTagSymbol = utils.ImportNow("to_string_tag_symbol");
-
-utils.Import(function(from) {
- MathMax = from.MathMax;
-});
-
-// -------------------------------------------------------------------
-
-
-function CheckSharedIntegerTypedArray(ia) {
- if (!%IsSharedIntegerTypedArray(ia)) {
- throw MakeTypeError(kNotIntegerSharedTypedArray, ia);
- }
-}
-
-function CheckSharedInteger32TypedArray(ia) {
- CheckSharedIntegerTypedArray(ia);
- if (%_ClassOf(ia) !== 'Int32Array') {
- throw MakeTypeError(kNotInt32SharedTypedArray, ia);
- }
-}
-
-//-------------------------------------------------------------------
-
-function AtomicsCompareExchangeJS(sta, index, oldValue, newValue) {
- CheckSharedIntegerTypedArray(sta);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
- return UNDEFINED;
- }
- oldValue = TO_NUMBER(oldValue);
- newValue = TO_NUMBER(newValue);
- return %_AtomicsCompareExchange(sta, index, oldValue, newValue);
-}
-
-function AtomicsLoadJS(sta, index) {
- CheckSharedIntegerTypedArray(sta);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
- return UNDEFINED;
- }
- return %_AtomicsLoad(sta, index);
-}
-
-function AtomicsStoreJS(sta, index, value) {
- CheckSharedIntegerTypedArray(sta);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(sta)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsStore(sta, index, value);
-}
-
-function AtomicsAddJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsAdd(ia, index, value);
-}
-
-function AtomicsSubJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsSub(ia, index, value);
-}
-
-function AtomicsAndJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsAnd(ia, index, value);
-}
-
-function AtomicsOrJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsOr(ia, index, value);
-}
-
-function AtomicsXorJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsXor(ia, index, value);
-}
-
-function AtomicsExchangeJS(ia, index, value) {
- CheckSharedIntegerTypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- value = TO_NUMBER(value);
- return %_AtomicsExchange(ia, index, value);
-}
-
-function AtomicsIsLockFreeJS(size) {
- return %_AtomicsIsLockFree(size);
-}
-
-// Futexes
-
-function AtomicsFutexWaitJS(ia, index, value, timeout) {
- CheckSharedInteger32TypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- if (IS_UNDEFINED(timeout)) {
- timeout = INFINITY;
- } else {
- timeout = TO_NUMBER(timeout);
- if (NUMBER_IS_NAN(timeout)) {
- timeout = INFINITY;
- } else {
- timeout = MathMax(0, timeout);
- }
- }
- return %AtomicsFutexWait(ia, index, value, timeout);
-}
-
-function AtomicsFutexWakeJS(ia, index, count) {
- CheckSharedInteger32TypedArray(ia);
- index = TO_INTEGER(index);
- if (index < 0 || index >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- count = MathMax(0, TO_INTEGER(count));
- return %AtomicsFutexWake(ia, index, count);
-}
-
-function AtomicsFutexWakeOrRequeueJS(ia, index1, count, value, index2) {
- CheckSharedInteger32TypedArray(ia);
- index1 = TO_INTEGER(index1);
- count = MathMax(0, TO_INTEGER(count));
- value = TO_INT32(value);
- index2 = TO_INTEGER(index2);
- if (index1 < 0 || index1 >= %_TypedArrayGetLength(ia) ||
- index2 < 0 || index2 >= %_TypedArrayGetLength(ia)) {
- return UNDEFINED;
- }
- return %AtomicsFutexWakeOrRequeue(ia, index1, count, value, index2);
-}
-
-// -------------------------------------------------------------------
-
-function AtomicsConstructor() {}
-
-var Atomics = new AtomicsConstructor();
-
-%InternalSetPrototype(Atomics, GlobalObject.prototype);
-%AddNamedProperty(global, "Atomics", Atomics, DONT_ENUM);
-%FunctionSetInstanceClassName(AtomicsConstructor, 'Atomics');
-
-%AddNamedProperty(Atomics, toStringTagSymbol, "Atomics", READ_ONLY | DONT_ENUM);
-
-// These must match the values in src/futex-emulation.h
-utils.InstallConstants(Atomics, [
- "OK", 0,
- "NOTEQUAL", -1,
- "TIMEDOUT", -2,
-]);
-
-utils.InstallFunctions(Atomics, DONT_ENUM, [
- "compareExchange", AtomicsCompareExchangeJS,
- "load", AtomicsLoadJS,
- "store", AtomicsStoreJS,
- "add", AtomicsAddJS,
- "sub", AtomicsSubJS,
- "and", AtomicsAndJS,
- "or", AtomicsOrJS,
- "xor", AtomicsXorJS,
- "exchange", AtomicsExchangeJS,
- "isLockFree", AtomicsIsLockFreeJS,
- "futexWait", AtomicsFutexWaitJS,
- "futexWake", AtomicsFutexWakeJS,
- "futexWakeOrRequeue", AtomicsFutexWakeOrRequeueJS,
-]);
-
-})
« no previous file with comments | « src/harmony-array-includes.js ('k') | src/harmony-concat-spreadable.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698