v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
api.cc File Reference
#include "api.h"
#include <math.h>
#include <string.h>
#include "../include/v8-debug.h"
#include "../include/v8-profiler.h"
#include "../include/v8-testing.h"
#include "bootstrapper.h"
#include "code-stubs.h"
#include "compiler.h"
#include "conversions-inl.h"
#include "counters.h"
#include "debug.h"
#include "deoptimizer.h"
#include "execution.h"
#include "global-handles.h"
#include "heap-profiler.h"
#include "messages.h"
#include "parser.h"
#include "platform.h"
#include "profile-generator-inl.h"
#include "property-details.h"
#include "property.h"
#include "runtime-profiler.h"
#include "scanner-character-streams.h"
#include "snapshot.h"
#include "unicode-inl.h"
#include "v8threads.h"
#include "version.h"
#include "vm-state-inl.h"
Include dependency graph for api.cc:

Go to the source code of this file.

Namespaces

 v8
 
 v8::internal
 

Macros

#define LOG_API(isolate, expr)   LOG(isolate, ApiEntryCall(expr))
 
#define ENTER_V8(isolate)
 
#define LEAVE_V8(isolate)   i::VMState __state__((isolate), i::EXTERNAL)
 
#define ON_BAILOUT(isolate, location, code)
 
#define EXCEPTION_PREAMBLE(isolate)
 
#define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback)
 
#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK(isolate, value)
 
#define EXCEPTION_BAILOUT_CHECK(isolate, value)   EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, ;)
 
#define API_ENTRY_CHECK(isolate, msg)
 
#define SET_FIELD_WRAPPED(obj, setter, cdata)
 
#define REGEXP_FLAG_ASSERT_EQ(api_flag, internal_flag)
 

Enumerations

enum  CompressedStartupDataItems {
  kSnapshot = 0, kSnapshotContext, kLibraries, kExperimentalLibraries,
  kCompressedStartupDataCount
}
 

Functions

Handle< Value > V8EXPORT ThrowException (Handle< Value > exception)
 
void V8EXPORT RegisterExtension (Extension *extension)
 
Handle< Primitive > V8EXPORT Undefined ()
 
Handle< Primitive > V8EXPORT Null ()
 
Handle< Boolean > V8EXPORT True ()
 
Handle< Boolean > V8EXPORT False ()
 
bool V8EXPORT SetResourceConstraints (ResourceConstraints *constraints)
 
i::Handle< i::StringNewExternalStringHandle (i::Isolate *isolate, v8::String::ExternalStringResource *resource)
 
i::Handle< i::StringNewExternalAsciiStringHandle (i::Isolate *isolate, v8::String::ExternalAsciiStringResource *resource)
 
 REGEXP_FLAG_ASSERT_EQ (kNone, NONE)
 
 REGEXP_FLAG_ASSERT_EQ (kGlobal, GLOBAL)
 
 REGEXP_FLAG_ASSERT_EQ (kIgnoreCase, IGNORE_CASE)
 
 REGEXP_FLAG_ASSERT_EQ (kMultiline, MULTILINE)
 

Macro Definition Documentation

#define API_ENTRY_CHECK (   isolate,
  msg 
)
Value:
do { \
ApiCheck(isolate->thread_manager()->IsLockedByCurrentThread(), \
msg, \
"Entering the V8 API without proper locking in place"); \
} \
} while (false)
static bool IsActive()
Definition: v8threads.cc:97

Definition at line 116 of file api.cc.

Referenced by HandleScope::HandleScope(), and V8::TerminateExecution().

#define ENTER_V8 (   isolate)
Value:
ASSERT((isolate)->IsInitialized()); \
i::VMState __state__((isolate), i::OTHER)
#define ASSERT(condition)
Definition: checks.h:270

Definition at line 65 of file api.cc.

Referenced by V8::AddMessageListener(), Context::AllowCodeGenerationFromStrings(), StackTrace::AsArray(), String::AsciiValue::AsciiValue(), Value::BooleanValue(), Function::Call(), Object::CallAsConstructor(), Object::CallAsFunction(), Object::Clone(), Array::CloneElementAt(), Script::Compile(), String::Concat(), Object::CreationContext(), StackTrace::CurrentStackTrace(), Date::DateTimeConfigurationChangeNotification(), Object::Delete(), Object::DeleteHiddenValue(), Context::DetachGlobal(), Context::Enter(), Value::Equals(), Exception::Error(), Object::FindInstanceInPrototypeChain(), Object::ForceDelete(), Object::ForceSet(), Message::Get(), Object::Get(), StackFrame::GetColumn(), Object::GetConstructor(), Object::GetConstructorName(), Message::GetEndColumn(), Message::GetEndPosition(), StackTrace::GetFrame(), StackTrace::GetFrameCount(), FunctionTemplate::GetFunction(), StackFrame::GetFunctionName(), Object::GetHiddenValue(), Object::GetIdentityHash(), Message::GetLineNumber(), StackFrame::GetLineNumber(), Object::GetOwnPropertyNames(), Object::GetPropertyAttributes(), Object::GetPropertyNames(), Object::GetPrototype(), Object::GetRealNamedProperty(), Object::GetRealNamedPropertyInPrototypeChain(), Message::GetScriptData(), StackFrame::GetScriptName(), StackFrame::GetScriptNameOrSourceURL(), Message::GetScriptResourceName(), Message::GetSourceLine(), Message::GetStackTrace(), Message::GetStartColumn(), Message::GetStartPosition(), Object::Has(), Object::HasRealNamedCallbackProperty(), FunctionTemplate::Inherit(), FunctionTemplate::InstanceTemplate(), Value::Int32Value(), Value::IntegerValue(), Object::IsCallable(), Context::IsCodeGenerationFromStringsAllowed(), StackFrame::IsConstructor(), StackFrame::IsEval(), String::MakeExternal(), ObjectTemplate::MarkAsUndetectable(), NeanderObject::NeanderObject(), Script::New(), String::New(), Number::New(), Integer::New(), Object::New(), Array::New(), Date::New(), NumberObject::New(), BooleanObject::New(), StringObject::New(), RegExp::New(), External::New(), FunctionTemplate::New(), Signature::New(), TypeSwitch::New(), Context::New(), String::NewExternal(), Integer::NewFromUnsigned(), Function::NewInstance(), ObjectTemplate::NewInstance(), String::NewSymbol(), String::NewUndetectable(), Value::NumberValue(), Object::ObjectProtoToString(), Message::PrintCurrentStackTrace(), FunctionTemplate::PrototypeTemplate(), Exception::RangeError(), FunctionTemplate::ReadOnlyPrototype(), Context::ReattachGlobal(), Exception::ReferenceError(), V8::RemoveMessageListeners(), Script::Run(), Object::Set(), Template::Set(), ObjectTemplate::SetAccessCheckCallbacks(), Object::SetAccessor(), ObjectTemplate::SetAccessor(), ObjectTemplate::SetCallAsFunctionHandler(), FunctionTemplate::SetCallHandler(), FunctionTemplate::SetClassName(), Context::SetErrorMessageForCodeGenerationFromStrings(), FunctionTemplate::SetHiddenPrototype(), Object::SetHiddenValue(), Object::SetIndexedPropertiesToExternalArrayData(), Object::SetIndexedPropertiesToPixelData(), ObjectTemplate::SetIndexedPropertyHandler(), Object::SetInternalField(), ObjectTemplate::SetInternalFieldCount(), Function::SetName(), ObjectTemplate::SetNamedPropertyHandler(), Object::SetPointerInInternalField(), Object::SetPrototype(), Context::SetSecurityToken(), Exception::SyntaxError(), v8::ThrowException(), Value::ToArrayIndex(), Value::ToBoolean(), Value::ToDetailString(), Value::ToInt32(), Value::ToInteger(), Value::ToNumber(), Value::ToObject(), Value::ToString(), Value::ToUint32(), Object::TurnOnAccessCheck(), Exception::TypeError(), Value::Uint32Value(), Context::UseDefaultSecurityToken(), String::Utf8Value::Utf8Value(), String::Value::Value(), External::Wrap(), String::Write(), String::WriteAscii(), and String::WriteUtf8().

#define EXCEPTION_BAILOUT_CHECK_DO_CALLBACK (   isolate,
  value 
)
Value:
isolate, value, i::V8::FireCallCompletedCallback(isolate);)
static void FireCallCompletedCallback(Isolate *isolate)
Definition: v8.cc:218
#define EXCEPTION_BAILOUT_CHECK_GENERIC(isolate, value, do_callback)
Definition: api.cc:87

Definition at line 107 of file api.cc.

Referenced by Function::Call(), Object::CallAsConstructor(), Object::CallAsFunction(), Function::NewInstance(), and Script::Run().

#define EXCEPTION_BAILOUT_CHECK_GENERIC (   isolate,
  value,
  do_callback 
)
Value:
do { \
i::HandleScopeImplementer* handle_scope_implementer = \
(isolate)->handle_scope_implementer(); \
handle_scope_implementer->DecrementCallDepth(); \
if (has_pending_exception) { \
if (handle_scope_implementer->CallDepthIsZero() && \
(isolate)->is_out_of_memory()) { \
if (!(isolate)->ignore_out_of_memory()) \
} \
bool call_depth_is_zero = handle_scope_implementer->CallDepthIsZero(); \
(isolate)->OptionalRescheduleException(call_depth_is_zero); \
do_callback \
return value; \
} \
do_callback \
} while (false)
void FatalProcessOutOfMemory(const char *message)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 and VFP2 enable use of VFP2 instructions if available enable use of SDIV and UDIV instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of MIPS FPU instructions if NULL

Definition at line 87 of file api.cc.

#define LEAVE_V8 (   isolate)    i::VMState __state__((isolate), i::EXTERNAL)

Definition at line 68 of file api.cc.

#define ON_BAILOUT (   isolate,
  location,
  code 
)
Value:
if (IsDeadCheck(isolate, location) || \
IsExecutionTerminatingCheck(isolate)) { \
}
#define UNREACHABLE()
Definition: checks.h:50
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination use dead code elimination trace on stack replacement optimize closures cache optimized code for closures functions with arguments object loop weight for representation inference allow uint32 values on optimize frames if they are used only in safe operations track parallel recompilation enable all profiler experiments number of stack frames inspected by the profiler call recompile stub directly when self optimizing trigger profiler ticks based on counting instead of timing weight back edges by jump distance for interrupt triggering percentage of ICs that must have type info to allow optimization watch_ic_patching retry_self_opt interrupt_at_exit extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments

Definition at line 73 of file api.cc.

Referenced by V8::AddMessageListener(), Function::Call(), Object::CallAsConstructor(), Object::CallAsFunction(), Object::Clone(), Array::CloneElementAt(), Script::Compile(), Object::CreationContext(), Date::DateTimeConfigurationChangeNotification(), Object::Delete(), Object::DeleteHiddenValue(), Exception::Error(), Object::FindInstanceInPrototypeChain(), Object::ForceDelete(), Object::ForceSet(), Message::Get(), Object::Get(), Object::GetConstructor(), Object::GetConstructorName(), FunctionTemplate::GetFunction(), Object::GetHiddenValue(), Object::GetIdentityHash(), Object::GetIndexedPropertiesExternalArrayData(), Object::GetIndexedPropertiesExternalArrayDataLength(), Object::GetIndexedPropertiesExternalArrayDataType(), Object::GetIndexedPropertiesPixelData(), Object::GetIndexedPropertiesPixelDataLength(), Message::GetLineNumber(), Object::GetOwnPropertyNames(), Object::GetPropertyAttributes(), Object::GetPropertyNames(), Object::GetPrototype(), Object::GetRealNamedProperty(), Object::GetRealNamedPropertyInPrototypeChain(), Message::GetSourceLine(), Object::Has(), Object::HasIndexedLookupInterceptor(), Object::HasIndexedPropertiesInExternalArrayData(), Object::HasIndexedPropertiesInPixelData(), FunctionTemplate::HasInstance(), Object::HasNamedLookupInterceptor(), Object::HasOwnProperty(), Object::HasRealIndexedProperty(), Object::HasRealNamedCallbackProperty(), Object::HasRealNamedProperty(), Script::Id(), Object::IsCallable(), Script::New(), Context::New(), Function::NewInstance(), ObjectTemplate::NewInstance(), Object::ObjectProtoToString(), Exception::RangeError(), Exception::ReferenceError(), V8::RemoveMessageListeners(), Script::Run(), Object::Set(), Object::SetAccessor(), Script::SetData(), Object::SetHiddenValue(), Object::SetIndexedPropertiesToExternalArrayData(), Object::SetIndexedPropertiesToPixelData(), Object::SetPrototype(), Exception::SyntaxError(), Object::TurnOnAccessCheck(), and Exception::TypeError().

#define REGEXP_FLAG_ASSERT_EQ (   api_flag,
  internal_flag 
)
Value:
STATIC_ASSERT(static_cast<int>(v8::RegExp::api_flag) == \
static_cast<int>(i::JSRegExp::internal_flag))
#define STATIC_ASSERT(test)
Definition: checks.h:283

Definition at line 5136 of file api.cc.

#define SET_FIELD_WRAPPED (   obj,
  setter,
  cdata 
)
Value:
do { \
i::Handle<i::Object> foreign = FromCData(cdata); \
(obj)->setter(*foreign); \
} while (false)
v8::internal::Handle< v8::internal::Object > FromCData(T obj)
Definition: api.h:128

Definition at line 1045 of file api.cc.

Referenced by ObjectTemplate::SetAccessCheckCallbacks(), and FunctionTemplate::SetCallHandler().