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

Side by Side Diff: src/api.cc

Issue 6737003: Removing unneeded TLS fetch from v8::Null and friends (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/apiutils.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 309
310 #ifdef DEBUG 310 #ifdef DEBUG
311 void ImplementationUtilities::ZapHandleRange(i::Object** begin, 311 void ImplementationUtilities::ZapHandleRange(i::Object** begin,
312 i::Object** end) { 312 i::Object** end) {
313 i::HandleScope::ZapRange(begin, end); 313 i::HandleScope::ZapRange(begin, end);
314 } 314 }
315 #endif 315 #endif
316 316
317 317
318 v8::Handle<v8::Primitive> ImplementationUtilities::Undefined() {
Vitaly Repeshko 2011/03/25 13:48:04 Yes, inlining these is the right thing to do. IIRC
319 i::Isolate* isolate = i::Isolate::Current();
320 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) {
321 return v8::Handle<v8::Primitive>();
322 }
323 return v8::Handle<Primitive>(ToApi<Primitive>(
324 isolate->factory()->undefined_value()));
325 }
326
327
328 v8::Handle<v8::Primitive> ImplementationUtilities::Null() {
329 i::Isolate* isolate = i::Isolate::UncheckedCurrent();
330 if (!EnsureInitializedForIsolate(isolate, "v8::Null()"))
331 return v8::Handle<v8::Primitive>();
332 return v8::Handle<Primitive>(
333 ToApi<Primitive>(isolate->factory()->null_value()));
334 }
335
336
337 v8::Handle<v8::Boolean> ImplementationUtilities::True() {
338 i::Isolate* isolate = i::Isolate::Current();
339 if (!EnsureInitializedForIsolate(isolate, "v8::True()")) {
340 return v8::Handle<v8::Boolean>();
341 }
342 return v8::Handle<v8::Boolean>(ToApi<Boolean>(
343 isolate->factory()->true_value()));
344 }
345
346
347 v8::Handle<v8::Boolean> ImplementationUtilities::False() {
348 i::Isolate* isolate = i::Isolate::Current();
349 if (!EnsureInitializedForIsolate(isolate, "v8::False()")) {
350 return v8::Handle<v8::Boolean>();
351 }
352 return v8::Handle<v8::Boolean>(ToApi<Boolean>(
353 isolate->factory()->false_value()));
354 }
355
356 void V8::SetFlagsFromString(const char* str, int length) { 318 void V8::SetFlagsFromString(const char* str, int length) {
357 i::FlagList::SetFlagsFromString(str, length); 319 i::FlagList::SetFlagsFromString(str, length);
358 } 320 }
359 321
360 322
361 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) { 323 void V8::SetFlagsFromCommandLine(int* argc, char** argv, bool remove_flags) {
362 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags); 324 i::FlagList::SetFlagsFromCommandLine(argc, argv, remove_flags);
363 } 325 }
364 326
365 327
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 const char** deps) 367 const char** deps)
406 : name_(name), 368 : name_(name),
407 source_(source), 369 source_(source),
408 dep_count_(dep_count), 370 dep_count_(dep_count),
409 deps_(deps), 371 deps_(deps),
410 auto_enable_(false) { } 372 auto_enable_(false) { }
411 373
412 374
413 v8::Handle<Primitive> Undefined() { 375 v8::Handle<Primitive> Undefined() {
414 i::Isolate* isolate = i::Isolate::Current(); 376 i::Isolate* isolate = i::Isolate::Current();
415 LOG_API(isolate, "Undefined"); 377 LOG_API(isolate, "Undefined");
Vitaly Repeshko 2011/03/25 13:48:04 This logging is useless.
416 return ImplementationUtilities::Undefined(); 378 if (!EnsureInitializedForIsolate(isolate, "v8::Undefined()")) {
379 return v8::Handle<v8::Primitive>();
380 }
381 return v8::Handle<Primitive>(ToApi<Primitive>(
382 isolate->factory()->undefined_value()));
417 } 383 }
418 384
419 385
420 v8::Handle<Primitive> Null() { 386 v8::Handle<Primitive> Null() {
421 i::Isolate* isolate = i::Isolate::Current(); 387 i::Isolate* isolate = i::Isolate::Current();
422 LOG_API(isolate, "Null"); 388 LOG_API(isolate, "Null");
423 return ImplementationUtilities::Null(); 389 if (!EnsureInitializedForIsolate(isolate, "v8::Null()"))
Vitaly Repeshko 2011/03/25 13:48:04 Let's make all if-s consistent by using {} when th
390 return v8::Handle<v8::Primitive>();
391 return v8::Handle<Primitive>(
392 ToApi<Primitive>(isolate->factory()->null_value()));
424 } 393 }
425 394
426 395
427 v8::Handle<Boolean> True() { 396 v8::Handle<Boolean> True() {
428 i::Isolate* isolate = i::Isolate::Current(); 397 i::Isolate* isolate = i::Isolate::Current();
429 LOG_API(isolate, "True"); 398 LOG_API(isolate, "True");
430 return ImplementationUtilities::True(); 399 if (!EnsureInitializedForIsolate(isolate, "v8::True()"))
400 return v8::Handle<Boolean>();
401 return v8::Handle<Boolean>(
402 ToApi<Boolean>(isolate->factory()->true_value()));
431 } 403 }
432 404
433 405
434 v8::Handle<Boolean> False() { 406 v8::Handle<Boolean> False() {
435 i::Isolate* isolate = i::Isolate::Current(); 407 i::Isolate* isolate = i::Isolate::Current();
436 LOG_API(isolate, "False"); 408 LOG_API(isolate, "False");
437 return ImplementationUtilities::False(); 409 if (!EnsureInitializedForIsolate(isolate, "v8::False()"))
410 return v8::Handle<Boolean>();
411 return v8::Handle<Boolean>(
412 ToApi<Boolean>(isolate->factory()->false_value()));
438 } 413 }
439 414
440 415
441 ResourceConstraints::ResourceConstraints() 416 ResourceConstraints::ResourceConstraints()
442 : max_young_space_size_(0), 417 : max_young_space_size_(0),
443 max_old_space_size_(0), 418 max_old_space_size_(0),
444 max_executable_size_(0), 419 max_executable_size_(0),
445 stack_limit_(NULL) { } 420 stack_limit_(NULL) { }
446 421
447 422
(...skipping 4825 matching lines...) Expand 10 before | Expand all | Expand 10 after
5273 case i::HeapGraphEdge::kProperty: 5248 case i::HeapGraphEdge::kProperty:
5274 case i::HeapGraphEdge::kShortcut: 5249 case i::HeapGraphEdge::kShortcut:
5275 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol( 5250 return Handle<String>(ToApi<String>(isolate->factory()->LookupAsciiSymbol(
5276 edge->name()))); 5251 edge->name())));
5277 case i::HeapGraphEdge::kElement: 5252 case i::HeapGraphEdge::kElement:
5278 case i::HeapGraphEdge::kHidden: 5253 case i::HeapGraphEdge::kHidden:
5279 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt( 5254 return Handle<Number>(ToApi<Number>(isolate->factory()->NewNumberFromInt(
5280 edge->index()))); 5255 edge->index())));
5281 default: UNREACHABLE(); 5256 default: UNREACHABLE();
5282 } 5257 }
5283 return ImplementationUtilities::Undefined(); 5258 return v8::Undefined();
5284 } 5259 }
5285 5260
5286 5261
5287 const HeapGraphNode* HeapGraphEdge::GetFromNode() const { 5262 const HeapGraphNode* HeapGraphEdge::GetFromNode() const {
5288 i::Isolate* isolate = i::Isolate::Current(); 5263 i::Isolate* isolate = i::Isolate::Current();
5289 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode"); 5264 IsDeadCheck(isolate, "v8::HeapGraphEdge::GetFromNode");
5290 const i::HeapEntry* from = ToInternal(this)->From(); 5265 const i::HeapEntry* from = ToInternal(this)->From();
5291 return reinterpret_cast<const HeapGraphNode*>(from); 5266 return reinterpret_cast<const HeapGraphNode*>(from);
5292 } 5267 }
5293 5268
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
5722 5697
5723 5698
5724 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { 5699 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) {
5725 HandleScopeImplementer* thread_local = 5700 HandleScopeImplementer* thread_local =
5726 reinterpret_cast<HandleScopeImplementer*>(storage); 5701 reinterpret_cast<HandleScopeImplementer*>(storage);
5727 thread_local->IterateThis(v); 5702 thread_local->IterateThis(v);
5728 return storage + ArchiveSpacePerThread(); 5703 return storage + ArchiveSpacePerThread();
5729 } 5704 }
5730 5705
5731 } } // namespace v8::internal 5706 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/apiutils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698