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

Side by Side Diff: src/interface.cc

Issue 669733007: Fix incorrect private access (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/interface.h ('k') | no next file » | 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interface.h" 7 #include "src/interface.h"
8 8
9 #include "src/base/lazy-instance.h" 9 #include "src/base/lazy-instance.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 // --------------------------------------------------------------------------- 14 // ---------------------------------------------------------------------------
15 // Initialization. 15 // Initialization.
16 16
17 struct Interface::ValueCreate { 17 struct Interface::Cache {
18 static void Construct(Interface* ptr) { 18 template<int flags>
19 ::new (ptr) Interface(VALUE + FROZEN); 19 struct Create {
20 } 20 static void Construct(Interface* ptr) { ::new (ptr) Interface(flags); }
21 };
22 typedef Create<VALUE + FROZEN> ValueCreate;
23 typedef Create<VALUE + CONST + FROZEN> ConstCreate;
24
25 static base::LazyInstance<Interface, ValueCreate>::type value_interface;
26 static base::LazyInstance<Interface, ConstCreate>::type const_interface;
21 }; 27 };
22 28
23 29
24 struct Interface::ConstCreate { 30 base::LazyInstance<Interface, Interface::Cache::ValueCreate>::type
25 static void Construct(Interface* ptr) { 31 Interface::Cache::value_interface = LAZY_INSTANCE_INITIALIZER;
26 ::new (ptr) Interface(VALUE + CONST + FROZEN);
27 }
28 };
29 32
30 33 base::LazyInstance<Interface, Interface::Cache::ConstCreate>::type
31 namespace { 34 Interface::Cache::const_interface = LAZY_INSTANCE_INITIALIZER;
32 base::LazyInstance<Interface, Interface::ValueCreate>::type value_interface =
33 LAZY_INSTANCE_INITIALIZER;
34
35 base::LazyInstance<Interface, Interface::ConstCreate>::type const_interface =
36 LAZY_INSTANCE_INITIALIZER;
37 }
38 35
39 36
40 Interface* Interface::NewValue() { 37 Interface* Interface::NewValue() {
41 return value_interface.Pointer(); // Cached. 38 return Cache::value_interface.Pointer(); // Cached.
42 } 39 }
43 40
44 41
45 Interface* Interface::NewConst() { 42 Interface* Interface::NewConst() {
46 return const_interface.Pointer(); // Cached. 43 return Cache::const_interface.Pointer(); // Cached.
47 } 44 }
48 45
49 46
50 // --------------------------------------------------------------------------- 47 // ---------------------------------------------------------------------------
51 // Lookup. 48 // Lookup.
52 49
53 Interface* Interface::Lookup(Handle<String> name, Zone* zone) { 50 Interface* Interface::Lookup(Handle<String> name, Zone* zone) {
54 DCHECK(IsModule()); 51 DCHECK(IsModule());
55 ZoneHashMap* map = Chase()->exports_; 52 ZoneHashMap* map = Chase()->exports_;
56 if (map == nullptr) return nullptr; 53 if (map == nullptr) return nullptr;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 PrintF("%*s%s : ", n0 + 2, "", name->ToAsciiArray()); 257 PrintF("%*s%s : ", n0 + 2, "", name->ToAsciiArray());
261 interface->Print(n0 + 2); 258 interface->Print(n0 + 2);
262 } 259 }
263 PrintF("%*s}\n", n0, ""); 260 PrintF("%*s}\n", n0, "");
264 } 261 }
265 } 262 }
266 } 263 }
267 #endif 264 #endif
268 265
269 } } // namespace v8::internal 266 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/interface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698