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

Side by Side Diff: src/d8.cc

Issue 2741683004: [rename] Rename internal field to embedder field. (Closed)
Patch Set: [rename] Rename internal field to embedder field. 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/crankshaft/hydrogen.cc ('k') | src/debug/debug.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 #include <errno.h> 5 #include <errno.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/stat.h> 8 #include <sys/stat.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 220
221 221
222 v8::Platform* g_platform = NULL; 222 v8::Platform* g_platform = NULL;
223 223
224 static Local<Value> Throw(Isolate* isolate, const char* message) { 224 static Local<Value> Throw(Isolate* isolate, const char* message) {
225 return isolate->ThrowException( 225 return isolate->ThrowException(
226 String::NewFromUtf8(isolate, message, NewStringType::kNormal) 226 String::NewFromUtf8(isolate, message, NewStringType::kNormal)
227 .ToLocalChecked()); 227 .ToLocalChecked());
228 } 228 }
229 229
230
231 Worker* GetWorkerFromInternalField(Isolate* isolate, Local<Object> object) { 230 Worker* GetWorkerFromInternalField(Isolate* isolate, Local<Object> object) {
232 if (object->InternalFieldCount() != 1) { 231 if (object->InternalFieldCount() != 1) {
233 Throw(isolate, "this is not a Worker"); 232 Throw(isolate, "this is not a Worker");
234 return NULL; 233 return NULL;
235 } 234 }
236 235
237 Worker* worker = 236 Worker* worker =
238 static_cast<Worker*>(object->GetAlignedPointerFromInternalField(0)); 237 static_cast<Worker*>(object->GetAlignedPointerFromInternalField(0));
239 if (worker == NULL) { 238 if (worker == NULL) {
240 Throw(isolate, "Worker is defunct because main thread is terminating"); 239 Throw(isolate, "Worker is defunct because main thread is terminating");
(...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after
1141 return; 1140 return;
1142 } 1141 }
1143 1142
1144 { 1143 {
1145 base::LockGuard<base::Mutex> lock_guard(workers_mutex_.Pointer()); 1144 base::LockGuard<base::Mutex> lock_guard(workers_mutex_.Pointer());
1146 if (workers_.length() >= kMaxWorkers) { 1145 if (workers_.length() >= kMaxWorkers) {
1147 Throw(args.GetIsolate(), "Too many workers, I won't let you create more"); 1146 Throw(args.GetIsolate(), "Too many workers, I won't let you create more");
1148 return; 1147 return;
1149 } 1148 }
1150 1149
1151 // Initialize the internal field to NULL; if we return early without 1150 // Initialize the embedder field to NULL; if we return early without
1152 // creating a new Worker (because the main thread is terminating) we can 1151 // creating a new Worker (because the main thread is terminating) we can
1153 // early-out from the instance calls. 1152 // early-out from the instance calls.
1154 args.Holder()->SetAlignedPointerInInternalField(0, NULL); 1153 args.Holder()->SetAlignedPointerInInternalField(0, NULL);
1155 1154
1156 if (!allow_new_workers_) return; 1155 if (!allow_new_workers_) return;
1157 1156
1158 Worker* worker = new Worker; 1157 Worker* worker = new Worker;
1159 args.Holder()->SetAlignedPointerInInternalField(0, worker); 1158 args.Holder()->SetAlignedPointerInInternalField(0, worker);
1160 workers_.Add(worker); 1159 workers_.Add(worker);
1161 1160
(...skipping 1881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 } 3042 }
3044 3043
3045 } // namespace v8 3044 } // namespace v8
3046 3045
3047 3046
3048 #ifndef GOOGLE3 3047 #ifndef GOOGLE3
3049 int main(int argc, char* argv[]) { 3048 int main(int argc, char* argv[]) {
3050 return v8::Shell::Main(argc, argv); 3049 return v8::Shell::Main(argc, argv);
3051 } 3050 }
3052 #endif 3051 #endif
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/debug/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698