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

Side by Side Diff: src/api.cc

Issue 60083: Move some more ENTER_V8 invocations. The biggest one is to move the... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 8 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 | 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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 1437 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 val = i::Execution::ToObject(obj, &has_pending_exception); 1448 val = i::Execution::ToObject(obj, &has_pending_exception);
1449 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>()); 1449 EXCEPTION_BAILOUT_CHECK(Local<v8::Object>());
1450 } 1450 }
1451 return Local<v8::Object>(ToApi<Object>(val)); 1451 return Local<v8::Object>(ToApi<Object>(val));
1452 } 1452 }
1453 1453
1454 1454
1455 Local<Boolean> Value::ToBoolean() const { 1455 Local<Boolean> Value::ToBoolean() const {
1456 if (IsDeadCheck("v8::Value::ToBoolean()")) return Local<Boolean>(); 1456 if (IsDeadCheck("v8::Value::ToBoolean()")) return Local<Boolean>();
1457 LOG_API("ToBoolean"); 1457 LOG_API("ToBoolean");
1458 ENTER_V8;
1459 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1458 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1460 i::Handle<i::Object> val = 1459 if (obj->IsBoolean()) {
1461 obj->IsBoolean() ? obj : i::Execution::ToBoolean(obj); 1460 return Local<Boolean>(ToApi<Boolean>(obj));
1462 return Local<Boolean>(ToApi<Boolean>(val)); 1461 } else {
1462 ENTER_V8;
1463 i::Handle<i::Object> val = i::Execution::ToBoolean(obj);
1464 return Local<Boolean>(ToApi<Boolean>(val));
1465 }
1463 } 1466 }
1464 1467
1465 1468
1466 Local<Number> Value::ToNumber() const { 1469 Local<Number> Value::ToNumber() const {
1467 if (IsDeadCheck("v8::Value::ToNumber()")) return Local<Number>(); 1470 if (IsDeadCheck("v8::Value::ToNumber()")) return Local<Number>();
1468 LOG_API("ToNumber"); 1471 LOG_API("ToNumber");
1469 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1472 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1470 i::Handle<i::Object> num; 1473 i::Handle<i::Object> num;
1471 if (obj->IsNumber()) { 1474 if (obj->IsNumber()) {
1472 num = obj; 1475 num = obj;
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1573 ApiCheck(obj->HasSpecificClassOf(i::Heap::Date_symbol()), 1576 ApiCheck(obj->HasSpecificClassOf(i::Heap::Date_symbol()),
1574 "v8::Date::Cast()", 1577 "v8::Date::Cast()",
1575 "Could not convert to date"); 1578 "Could not convert to date");
1576 return static_cast<v8::Date*>(that); 1579 return static_cast<v8::Date*>(that);
1577 } 1580 }
1578 1581
1579 1582
1580 bool Value::BooleanValue() const { 1583 bool Value::BooleanValue() const {
1581 if (IsDeadCheck("v8::Value::BooleanValue()")) return false; 1584 if (IsDeadCheck("v8::Value::BooleanValue()")) return false;
1582 LOG_API("BooleanValue"); 1585 LOG_API("BooleanValue");
1583 ENTER_V8;
1584 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1586 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1585 i::Handle<i::Object> value = 1587 if (obj->IsBoolean()) {
1586 obj->IsBoolean() ? obj : i::Execution::ToBoolean(obj); 1588 return obj->IsTrue();
1587 return value->IsTrue(); 1589 } else {
1590 ENTER_V8;
1591 i::Handle<i::Object> value = i::Execution::ToBoolean(obj);
1592 return value->IsTrue();
1593 }
1588 } 1594 }
1589 1595
1590 1596
1591 double Value::NumberValue() const { 1597 double Value::NumberValue() const {
1592 if (IsDeadCheck("v8::Value::NumberValue()")) return i::OS::nan_value(); 1598 if (IsDeadCheck("v8::Value::NumberValue()")) return i::OS::nan_value();
1593 LOG_API("NumberValue"); 1599 LOG_API("NumberValue");
1594 i::Handle<i::Object> obj = Utils::OpenHandle(this); 1600 i::Handle<i::Object> obj = Utils::OpenHandle(this);
1595 i::Handle<i::Object> num; 1601 i::Handle<i::Object> num;
1596 if (obj->IsNumber()) { 1602 if (obj->IsNumber()) {
1597 num = obj; 1603 num = obj;
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 } 2346 }
2341 ENTER_V8; 2347 ENTER_V8;
2342 i::Handle<i::Object> val = Utils::OpenHandle(*value); 2348 i::Handle<i::Object> val = Utils::OpenHandle(*value);
2343 obj->SetInternalField(index, *val); 2349 obj->SetInternalField(index, *val);
2344 } 2350 }
2345 2351
2346 2352
2347 // --- E n v i r o n m e n t --- 2353 // --- E n v i r o n m e n t ---
2348 2354
2349 bool v8::V8::Initialize() { 2355 bool v8::V8::Initialize() {
2356 if (i::V8::HasBeenSetup()) return true;
2350 ENTER_V8; 2357 ENTER_V8;
2351 if (i::V8::HasBeenSetup()) return true;
2352 HandleScope scope; 2358 HandleScope scope;
2353 if (i::Snapshot::Initialize()) { 2359 if (i::Snapshot::Initialize()) {
2354 return true; 2360 return true;
2355 } else { 2361 } else {
2356 return i::V8::Initialize(NULL); 2362 return i::V8::Initialize(NULL);
2357 } 2363 }
2358 } 2364 }
2359 2365
2360 2366
2361 bool v8::V8::Dispose() { 2367 bool v8::V8::Dispose() {
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 reinterpret_cast<HandleScopeImplementer*>(storage); 3337 reinterpret_cast<HandleScopeImplementer*>(storage);
3332 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); 3338 List<void**>* blocks_of_archived_thread = thread_local->Blocks();
3333 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = 3339 v8::ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread =
3334 &thread_local->handle_scope_data_; 3340 &thread_local->handle_scope_data_;
3335 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); 3341 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread);
3336 3342
3337 return storage + ArchiveSpacePerThread(); 3343 return storage + ArchiveSpacePerThread();
3338 } 3344 }
3339 3345
3340 } } // namespace v8::internal 3346 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698