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

Side by Side Diff: include/v8.h

Issue 1507823002: Improve style of V8 API code (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove unused <string> include Created 5 years 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 | « no previous file | src/api.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 /** \mainpage V8 API Reference Guide 5 /** \mainpage V8 API Reference Guide
6 * 6 *
7 * V8 is Google's open source JavaScript engine. 7 * V8 is Google's open source JavaScript engine.
8 * 8 *
9 * This set of documents provides reference material generated from the 9 * This set of documents provides reference material generated from the
10 * V8 header file, include/v8.h. 10 * V8 header file, include/v8.h.
11 * 11 *
12 * For other documentation see http://code.google.com/apis/v8/ 12 * For other documentation see http://code.google.com/apis/v8/
13 */ 13 */
14 14
15 #ifndef V8_H_ 15 #ifndef INCLUDE_V8_H_
16 #define V8_H_ 16 #define INCLUDE_V8_H_
17 17
18 #include <stddef.h> 18 #include <stddef.h>
19 #include <stdint.h> 19 #include <stdint.h>
20 #include <stdio.h> 20 #include <stdio.h>
21 21
22 #include <string>
Michael Starzinger 2015/12/07 22:17:47 As discussed offline, this is most likely a false
23
22 #include "v8-version.h" // NOLINT(build/include) 24 #include "v8-version.h" // NOLINT(build/include)
23 #include "v8config.h" // NOLINT(build/include) 25 #include "v8config.h" // NOLINT(build/include)
24 26
25 // We reserve the V8_* prefix for macros defined in V8 public API and 27 // We reserve the V8_* prefix for macros defined in V8 public API and
26 // assume there are no name conflicts with the embedder's code. 28 // assume there are no name conflicts with the embedder's code.
27 29
28 #ifdef V8_OS_WIN 30 #ifdef V8_OS_WIN
29 31
30 // Setup for Windows DLL export/import. When building the V8 DLL the 32 // Setup for Windows DLL export/import. When building the V8 DLL the
31 // BUILDING_V8_SHARED needs to be defined. When building a program which uses 33 // BUILDING_V8_SHARED needs to be defined. When building a program which uses
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 * A JavaScript symbol (ECMA-262 edition 6) 2451 * A JavaScript symbol (ECMA-262 edition 6)
2450 * 2452 *
2451 * This is an experimental feature. Use at your own risk. 2453 * This is an experimental feature. Use at your own risk.
2452 */ 2454 */
2453 class V8_EXPORT Symbol : public Name { 2455 class V8_EXPORT Symbol : public Name {
2454 public: 2456 public:
2455 // Returns the print name string of the symbol, or undefined if none. 2457 // Returns the print name string of the symbol, or undefined if none.
2456 Local<Value> Name() const; 2458 Local<Value> Name() const;
2457 2459
2458 // Create a symbol. If name is not empty, it will be used as the description. 2460 // Create a symbol. If name is not empty, it will be used as the description.
2459 static Local<Symbol> New( 2461 static Local<Symbol> New(Isolate* isolate,
2460 Isolate *isolate, Local<String> name = Local<String>()); 2462 Local<String> name = Local<String>());
2461 2463
2462 // Access global symbol registry. 2464 // Access global symbol registry.
2463 // Note that symbols created this way are never collected, so 2465 // Note that symbols created this way are never collected, so
2464 // they should only be used for statically fixed properties. 2466 // they should only be used for statically fixed properties.
2465 // Also, there is only one global name space for the names used as keys. 2467 // Also, there is only one global name space for the names used as keys.
2466 // To minimize the potential for clashes, use qualified names as keys. 2468 // To minimize the potential for clashes, use qualified names as keys.
2467 static Local<Symbol> For(Isolate *isolate, Local<String> name); 2469 static Local<Symbol> For(Isolate *isolate, Local<String> name);
2468 2470
2469 // Retrieve a global symbol. Similar to |For|, but using a separate 2471 // Retrieve a global symbol. Similar to |For|, but using a separate
2470 // registry that is not accessible by (and cannot clash with) JavaScript code. 2472 // registry that is not accessible by (and cannot clash with) JavaScript code.
(...skipping 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after
7164 7166
7165 V8_INLINE static void UpdateNodeState(internal::Object** obj, 7167 V8_INLINE static void UpdateNodeState(internal::Object** obj,
7166 uint8_t value) { 7168 uint8_t value) {
7167 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset; 7169 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + kNodeFlagsOffset;
7168 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); 7170 *addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value);
7169 } 7171 }
7170 7172
7171 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, 7173 V8_INLINE static void SetEmbedderData(v8::Isolate* isolate,
7172 uint32_t slot, 7174 uint32_t slot,
7173 void* data) { 7175 void* data) {
7174 uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) + 7176 uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) +
7175 kIsolateEmbedderDataOffset + slot * kApiPointerSize; 7177 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
7176 *reinterpret_cast<void**>(addr) = data; 7178 *reinterpret_cast<void**>(addr) = data;
7177 } 7179 }
7178 7180
7179 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, 7181 V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate,
7180 uint32_t slot) { 7182 uint32_t slot) {
7181 const uint8_t* addr = reinterpret_cast<const uint8_t*>(isolate) + 7183 const uint8_t* addr = reinterpret_cast<const uint8_t*>(isolate) +
7182 kIsolateEmbedderDataOffset + slot * kApiPointerSize; 7184 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
7183 return *reinterpret_cast<void* const*>(addr); 7185 return *reinterpret_cast<void* const*>(addr);
7184 } 7186 }
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after
8467 * \example process.cc 8469 * \example process.cc
8468 */ 8470 */
8469 8471
8470 8472
8471 } // namespace v8 8473 } // namespace v8
8472 8474
8473 8475
8474 #undef TYPE_CHECK 8476 #undef TYPE_CHECK
8475 8477
8476 8478
8477 #endif // V8_H_ 8479 #endif // INCLUDE_V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698