| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3519 return false); | 3519 return false); |
| 3520 return i::JSReceiver::HasLocalProperty( | 3520 return i::JSReceiver::HasLocalProperty( |
| 3521 Utils::OpenHandle(this), Utils::OpenHandle(*key)); | 3521 Utils::OpenHandle(this), Utils::OpenHandle(*key)); |
| 3522 } | 3522 } |
| 3523 | 3523 |
| 3524 | 3524 |
| 3525 bool v8::Object::HasRealNamedProperty(Handle<String> key) { | 3525 bool v8::Object::HasRealNamedProperty(Handle<String> key) { |
| 3526 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3526 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3527 ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()", | 3527 ON_BAILOUT(isolate, "v8::Object::HasRealNamedProperty()", |
| 3528 return false); | 3528 return false); |
| 3529 return Utils::OpenHandle(this)->HasRealNamedProperty( | 3529 return i::JSObject::HasRealNamedProperty(Utils::OpenHandle(this), |
| 3530 isolate, | 3530 Utils::OpenHandle(*key)); |
| 3531 *Utils::OpenHandle(*key)); | |
| 3532 } | 3531 } |
| 3533 | 3532 |
| 3534 | 3533 |
| 3535 bool v8::Object::HasRealIndexedProperty(uint32_t index) { | 3534 bool v8::Object::HasRealIndexedProperty(uint32_t index) { |
| 3536 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3535 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3537 ON_BAILOUT(isolate, "v8::Object::HasRealIndexedProperty()", | 3536 ON_BAILOUT(isolate, "v8::Object::HasRealIndexedProperty()", |
| 3538 return false); | 3537 return false); |
| 3539 return Utils::OpenHandle(this)->HasRealElementProperty(isolate, index); | 3538 return i::JSObject::HasRealElementProperty(Utils::OpenHandle(this), index); |
| 3540 } | 3539 } |
| 3541 | 3540 |
| 3542 | 3541 |
| 3543 bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) { | 3542 bool v8::Object::HasRealNamedCallbackProperty(Handle<String> key) { |
| 3544 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3543 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3545 ON_BAILOUT(isolate, | 3544 ON_BAILOUT(isolate, |
| 3546 "v8::Object::HasRealNamedCallbackProperty()", | 3545 "v8::Object::HasRealNamedCallbackProperty()", |
| 3547 return false); | 3546 return false); |
| 3548 ENTER_V8(isolate); | 3547 ENTER_V8(isolate); |
| 3549 return Utils::OpenHandle(this)->HasRealNamedCallbackProperty( | 3548 return i::JSObject::HasRealNamedCallbackProperty(Utils::OpenHandle(this), |
| 3550 isolate, | 3549 Utils::OpenHandle(*key)); |
| 3551 *Utils::OpenHandle(*key)); | |
| 3552 } | 3550 } |
| 3553 | 3551 |
| 3554 | 3552 |
| 3555 bool v8::Object::HasNamedLookupInterceptor() { | 3553 bool v8::Object::HasNamedLookupInterceptor() { |
| 3556 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); | 3554 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 3557 ON_BAILOUT(isolate, "v8::Object::HasNamedLookupInterceptor()", | 3555 ON_BAILOUT(isolate, "v8::Object::HasNamedLookupInterceptor()", |
| 3558 return false); | 3556 return false); |
| 3559 return Utils::OpenHandle(this)->HasNamedInterceptor(); | 3557 return Utils::OpenHandle(this)->HasNamedInterceptor(); |
| 3560 } | 3558 } |
| 3561 | 3559 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4105 } | 4103 } |
| 4106 | 4104 |
| 4107 | 4105 |
| 4108 Handle<Value> Function::GetInferredName() const { | 4106 Handle<Value> Function::GetInferredName() const { |
| 4109 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4107 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4110 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), | 4108 return Utils::ToLocal(i::Handle<i::Object>(func->shared()->inferred_name(), |
| 4111 func->GetIsolate())); | 4109 func->GetIsolate())); |
| 4112 } | 4110 } |
| 4113 | 4111 |
| 4114 | 4112 |
| 4113 Handle<Value> Function::GetDisplayName() const { |
| 4114 i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate(); |
| 4115 ON_BAILOUT(isolate, "v8::Function::GetDisplayName()", |
| 4116 return ToApiHandle<Primitive>( |
| 4117 isolate->factory()->undefined_value())); |
| 4118 ENTER_V8(isolate); |
| 4119 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4120 i::Handle<i::String> property_name = |
| 4121 isolate->factory()->InternalizeOneByteString( |
| 4122 STATIC_ASCII_VECTOR("displayName")); |
| 4123 i::LookupResult lookup(isolate); |
| 4124 func->LookupRealNamedProperty(*property_name, &lookup); |
| 4125 if (lookup.IsFound()) { |
| 4126 i::Object* value = lookup.GetLazyValue(); |
| 4127 if (value && value->IsString()) { |
| 4128 i::String* name = i::String::cast(value); |
| 4129 if (name->length() > 0) return Utils::ToLocal(i::Handle<i::String>(name)); |
| 4130 } |
| 4131 } |
| 4132 return ToApiHandle<Primitive>(isolate->factory()->undefined_value()); |
| 4133 } |
| 4134 |
| 4135 |
| 4115 ScriptOrigin Function::GetScriptOrigin() const { | 4136 ScriptOrigin Function::GetScriptOrigin() const { |
| 4116 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4137 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4117 if (func->shared()->script()->IsScript()) { | 4138 if (func->shared()->script()->IsScript()) { |
| 4118 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4139 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4119 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); | 4140 i::Handle<i::Object> scriptName = GetScriptNameOrSourceURL(script); |
| 4120 v8::ScriptOrigin origin( | 4141 v8::ScriptOrigin origin( |
| 4121 Utils::ToLocal(scriptName), | 4142 Utils::ToLocal(scriptName), |
| 4122 v8::Integer::New(script->line_offset()->value()), | 4143 v8::Integer::New(script->line_offset()->value()), |
| 4123 v8::Integer::New(script->column_offset()->value())); | 4144 v8::Integer::New(script->column_offset()->value())); |
| 4124 return origin; | 4145 return origin; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4143 int Function::GetScriptColumnNumber() const { | 4164 int Function::GetScriptColumnNumber() const { |
| 4144 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4165 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4145 if (func->shared()->script()->IsScript()) { | 4166 if (func->shared()->script()->IsScript()) { |
| 4146 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4167 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4147 return i::GetScriptColumnNumber(script, func->shared()->start_position()); | 4168 return i::GetScriptColumnNumber(script, func->shared()->start_position()); |
| 4148 } | 4169 } |
| 4149 return kLineOffsetNotFound; | 4170 return kLineOffsetNotFound; |
| 4150 } | 4171 } |
| 4151 | 4172 |
| 4152 | 4173 |
| 4174 bool Function::IsBuiltin() const { |
| 4175 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4176 return func->IsBuiltin(); |
| 4177 } |
| 4178 |
| 4179 |
| 4153 Handle<Value> Function::GetScriptId() const { | 4180 Handle<Value> Function::GetScriptId() const { |
| 4154 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); | 4181 i::Handle<i::JSFunction> func = Utils::OpenHandle(this); |
| 4155 i::Isolate* isolate = func->GetIsolate(); | 4182 i::Isolate* isolate = func->GetIsolate(); |
| 4156 if (!func->shared()->script()->IsScript()) { | 4183 if (!func->shared()->script()->IsScript()) { |
| 4157 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 4184 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 4158 } | 4185 } |
| 4159 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); | 4186 i::Handle<i::Script> script(i::Script::cast(func->shared()->script())); |
| 4160 return Utils::ToLocal(i::Handle<i::Object>(script->id(), isolate)); | 4187 return Utils::ToLocal(i::Handle<i::Object>(script->id(), isolate)); |
| 4161 } | 4188 } |
| 4162 | 4189 |
| (...skipping 2180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6343 // to deal more gracefully with out of memory situations. | 6370 // to deal more gracefully with out of memory situations. |
| 6344 if (value.IsEmpty()) { | 6371 if (value.IsEmpty()) { |
| 6345 isolate->ScheduleThrow(isolate->heap()->undefined_value()); | 6372 isolate->ScheduleThrow(isolate->heap()->undefined_value()); |
| 6346 } else { | 6373 } else { |
| 6347 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); | 6374 isolate->ScheduleThrow(*Utils::OpenHandle(*value)); |
| 6348 } | 6375 } |
| 6349 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); | 6376 return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate)); |
| 6350 } | 6377 } |
| 6351 | 6378 |
| 6352 | 6379 |
| 6353 void Isolate::SetObjectGroupId(const Persistent<Value>& object, | 6380 void Isolate::SetObjectGroupId(internal::Object** object, UniqueId id) { |
| 6354 UniqueId id) { | |
| 6355 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6381 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6356 internal_isolate->global_handles()->SetObjectGroupId( | 6382 internal_isolate->global_handles()->SetObjectGroupId( |
| 6357 Utils::OpenPersistent(object).location(), | 6383 v8::internal::Handle<v8::internal::Object>(object).location(), |
| 6358 id); | 6384 id); |
| 6359 } | 6385 } |
| 6360 | 6386 |
| 6361 | 6387 |
| 6362 void Isolate::SetReferenceFromGroup(UniqueId id, | 6388 void Isolate::SetReferenceFromGroup(UniqueId id, internal::Object** object) { |
| 6363 const Persistent<Value>& object) { | |
| 6364 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6389 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6365 internal_isolate->global_handles()->SetReferenceFromGroup( | 6390 internal_isolate->global_handles()->SetReferenceFromGroup( |
| 6366 id, | 6391 id, |
| 6367 Utils::OpenPersistent(object).location()); | 6392 v8::internal::Handle<v8::internal::Object>(object).location()); |
| 6368 } | 6393 } |
| 6369 | 6394 |
| 6370 | 6395 |
| 6371 void Isolate::SetReference(const Persistent<Object>& parent, | 6396 void Isolate::SetReference(internal::Object** parent, |
| 6372 const Persistent<Value>& child) { | 6397 internal::Object** child) { |
| 6373 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); | 6398 i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this); |
| 6374 i::Object** parent_location = Utils::OpenPersistent(parent).location(); | 6399 i::Object** parent_location = |
| 6400 v8::internal::Handle<v8::internal::Object>(parent).location(); |
| 6375 internal_isolate->global_handles()->SetReference( | 6401 internal_isolate->global_handles()->SetReference( |
| 6376 reinterpret_cast<i::HeapObject**>(parent_location), | 6402 reinterpret_cast<i::HeapObject**>(parent_location), |
| 6377 Utils::OpenPersistent(child).location()); | 6403 v8::internal::Handle<v8::internal::Object>(child).location()); |
| 6378 } | 6404 } |
| 6379 | 6405 |
| 6380 | 6406 |
| 6381 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback, | 6407 void Isolate::AddGCPrologueCallback(GCPrologueCallback callback, |
| 6382 GCType gc_type) { | 6408 GCType gc_type) { |
| 6383 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); | 6409 i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this); |
| 6384 isolate->heap()->AddGCPrologueCallback(callback, gc_type); | 6410 isolate->heap()->AddGCPrologueCallback(callback, gc_type); |
| 6385 } | 6411 } |
| 6386 | 6412 |
| 6387 | 6413 |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6921 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( | 6947 return ToApiHandle<String>(isolate->factory()->InternalizeUtf8String( |
| 6922 node->entry()->resource_name())); | 6948 node->entry()->resource_name())); |
| 6923 } | 6949 } |
| 6924 | 6950 |
| 6925 | 6951 |
| 6926 int CpuProfileNode::GetLineNumber() const { | 6952 int CpuProfileNode::GetLineNumber() const { |
| 6927 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); | 6953 return reinterpret_cast<const i::ProfileNode*>(this)->entry()->line_number(); |
| 6928 } | 6954 } |
| 6929 | 6955 |
| 6930 | 6956 |
| 6957 int CpuProfileNode::GetColumnNumber() const { |
| 6958 return reinterpret_cast<const i::ProfileNode*>(this)-> |
| 6959 entry()->column_number(); |
| 6960 } |
| 6961 |
| 6962 |
| 6931 const char* CpuProfileNode::GetBailoutReason() const { | 6963 const char* CpuProfileNode::GetBailoutReason() const { |
| 6932 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); | 6964 const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this); |
| 6933 return node->entry()->bailout_reason(); | 6965 return node->entry()->bailout_reason(); |
| 6934 } | 6966 } |
| 6935 | 6967 |
| 6936 | 6968 |
| 6937 unsigned CpuProfileNode::GetHitCount() const { | 6969 unsigned CpuProfileNode::GetHitCount() const { |
| 6938 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); | 6970 return reinterpret_cast<const i::ProfileNode*>(this)->self_ticks(); |
| 6939 } | 6971 } |
| 6940 | 6972 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7287 GetMemorySizeUsedByProfiler(); | 7319 GetMemorySizeUsedByProfiler(); |
| 7288 } | 7320 } |
| 7289 | 7321 |
| 7290 | 7322 |
| 7291 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, | 7323 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, |
| 7292 RetainedObjectInfo* info) { | 7324 RetainedObjectInfo* info) { |
| 7293 reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); | 7325 reinterpret_cast<i::HeapProfiler*>(this)->SetRetainedObjectInfo(id, info); |
| 7294 } | 7326 } |
| 7295 | 7327 |
| 7296 | 7328 |
| 7329 void HeapProfiler::StartRecordingHeapAllocations() { |
| 7330 reinterpret_cast<i::HeapProfiler*>(this)->StartHeapAllocationsRecording(); |
| 7331 } |
| 7332 |
| 7333 |
| 7334 void HeapProfiler::StopRecordingHeapAllocations() { |
| 7335 reinterpret_cast<i::HeapProfiler*>(this)->StopHeapAllocationsRecording(); |
| 7336 } |
| 7337 |
| 7338 |
| 7297 v8::Testing::StressType internal::Testing::stress_type_ = | 7339 v8::Testing::StressType internal::Testing::stress_type_ = |
| 7298 v8::Testing::kStressTypeOpt; | 7340 v8::Testing::kStressTypeOpt; |
| 7299 | 7341 |
| 7300 | 7342 |
| 7301 void Testing::SetStressRunType(Testing::StressType type) { | 7343 void Testing::SetStressRunType(Testing::StressType type) { |
| 7302 internal::Testing::set_stress_type(type); | 7344 internal::Testing::set_stress_type(type); |
| 7303 } | 7345 } |
| 7304 | 7346 |
| 7305 | 7347 |
| 7306 int Testing::GetStressRuns() { | 7348 int Testing::GetStressRuns() { |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7528 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7570 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7529 Address callback_address = | 7571 Address callback_address = |
| 7530 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7572 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7531 VMState<EXTERNAL> state(isolate); | 7573 VMState<EXTERNAL> state(isolate); |
| 7532 ExternalCallbackScope call_scope(isolate, callback_address); | 7574 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7533 callback(info); | 7575 callback(info); |
| 7534 } | 7576 } |
| 7535 | 7577 |
| 7536 | 7578 |
| 7537 } } // namespace v8::internal | 7579 } } // namespace v8::internal |
| OLD | NEW |