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

Side by Side Diff: src/builtins/builtins-sharedarraybuffer.cc

Issue 2741413006: [SAB] Implement SharedArrayBuffer.prototype.slice (Closed)
Patch Set: dedupe Created 3 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
« no previous file with comments | « src/builtins/builtins-arraybuffer.cc ('k') | src/messages.h » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 #include "src/base/macros.h" 5 #include "src/base/macros.h"
6 #include "src/base/platform/mutex.h" 6 #include "src/base/platform/mutex.h"
7 #include "src/base/platform/time.h" 7 #include "src/base/platform/time.h"
8 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
9 #include "src/builtins/builtins.h" 9 #include "src/builtins/builtins.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
11 #include "src/conversions-inl.h" 11 #include "src/conversions-inl.h"
12 #include "src/counters.h" 12 #include "src/counters.h"
13 #include "src/factory.h" 13 #include "src/factory.h"
14 #include "src/futex-emulation.h" 14 #include "src/futex-emulation.h"
15 #include "src/globals.h" 15 #include "src/globals.h"
16 #include "src/objects-inl.h" 16 #include "src/objects-inl.h"
17 17
18 namespace v8 { 18 namespace v8 {
19 namespace internal { 19 namespace internal {
20 20
21 // ES7 sharedmem 6.3.4.1 get SharedArrayBuffer.prototype.byteLength 21 // See builtins-arraybuffer.cc for implementations of
22 BUILTIN(SharedArrayBufferPrototypeGetByteLength) { 22 // SharedArrayBuffer.prototye.byteLength and SharedArrayBuffer.prototype.slice
23 HandleScope scope(isolate);
24 CHECK_RECEIVER(JSArrayBuffer, array_buffer,
25 "get SharedArrayBuffer.prototype.byteLength");
26 if (!array_buffer->is_shared()) {
27 THROW_NEW_ERROR_RETURN_FAILURE(
28 isolate, NewTypeError(MessageTemplate::kIncompatibleMethodReceiver,
29 isolate->factory()->NewStringFromAsciiChecked(
30 "get SharedArrayBuffer.prototype.byteLength"),
31 args.receiver()));
32 }
33 return array_buffer->byte_length();
34 }
35 23
36 inline bool AtomicIsLockFree(uint32_t size) { 24 inline bool AtomicIsLockFree(uint32_t size) {
37 return size == 1 || size == 2 || size == 4; 25 return size == 1 || size == 2 || size == 4;
38 } 26 }
39 27
40 // ES #sec-atomics.islockfree 28 // ES #sec-atomics.islockfree
41 BUILTIN(AtomicsIsLockFree) { 29 BUILTIN(AtomicsIsLockFree) {
42 HandleScope scope(isolate); 30 HandleScope scope(isolate);
43 Handle<Object> size = args.atOrUndefined(isolate, 1); 31 Handle<Object> size = args.atOrUndefined(isolate, 1);
44 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, size, Object::ToNumber(size)); 32 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, size, Object::ToNumber(size));
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 default: 540 default:
553 break; 541 break;
554 } 542 }
555 543
556 UNREACHABLE(); 544 UNREACHABLE();
557 return isolate->heap()->undefined_value(); 545 return isolate->heap()->undefined_value();
558 } 546 }
559 547
560 } // namespace internal 548 } // namespace internal
561 } // namespace v8 549 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/builtins-arraybuffer.cc ('k') | src/messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698