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

Side by Side Diff: src/api.h

Issue 1172683003: Use the LookupIterator for SetElement and friends (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 5 years, 6 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 | « 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 #ifndef V8_API_H_ 5 #ifndef V8_API_H_
6 #define V8_API_H_ 6 #define V8_API_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "include/v8-testing.h" 10 #include "include/v8-testing.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 89
90 void NeanderObject::set(int offset, v8::internal::Object* value) { 90 void NeanderObject::set(int offset, v8::internal::Object* value) {
91 DCHECK(value_->HasFastObjectElements()); 91 DCHECK(value_->HasFastObjectElements());
92 v8::internal::FixedArray::cast(value_->elements())->set(offset, value); 92 v8::internal::FixedArray::cast(value_->elements())->set(offset, value);
93 } 93 }
94 94
95 95
96 template <typename T> inline T ToCData(v8::internal::Object* obj) { 96 template <typename T> inline T ToCData(v8::internal::Object* obj) {
97 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); 97 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
98 if (obj == v8::internal::Smi::FromInt(0)) return nullptr;
98 return reinterpret_cast<T>( 99 return reinterpret_cast<T>(
99 reinterpret_cast<intptr_t>( 100 reinterpret_cast<intptr_t>(
100 v8::internal::Foreign::cast(obj)->foreign_address())); 101 v8::internal::Foreign::cast(obj)->foreign_address()));
101 } 102 }
102 103
103 104
104 template <typename T> 105 template <typename T>
105 inline v8::internal::Handle<v8::internal::Object> FromCData( 106 inline v8::internal::Handle<v8::internal::Object> FromCData(
106 v8::internal::Isolate* isolate, T obj) { 107 v8::internal::Isolate* isolate, T obj) {
107 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address)); 108 STATIC_ASSERT(sizeof(T) == sizeof(v8::internal::Address));
109 if (obj == nullptr) return handle(v8::internal::Smi::FromInt(0), isolate);
108 return isolate->factory()->NewForeign( 110 return isolate->factory()->NewForeign(
109 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj))); 111 reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(obj)));
110 } 112 }
111 113
112 114
113 class ApiFunction { 115 class ApiFunction {
114 public: 116 public:
115 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { } 117 explicit ApiFunction(v8::internal::Address addr) : addr_(addr) { }
116 v8::internal::Address address() { return addr_; } 118 v8::internal::Address address() { return addr_; }
117 private: 119 private:
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 stress_type_ = stress_type; 716 stress_type_ = stress_type;
715 } 717 }
716 718
717 private: 719 private:
718 static v8::Testing::StressType stress_type_; 720 static v8::Testing::StressType stress_type_;
719 }; 721 };
720 722
721 } } // namespace v8::internal 723 } } // namespace v8::internal
722 724
723 #endif // V8_API_H_ 725 #endif // V8_API_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