OLD | NEW |
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 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 return scope.Close(Utils::StackTraceToLocal(stackTrace)); | 1500 return scope.Close(Utils::StackTraceToLocal(stackTrace)); |
1501 } | 1501 } |
1502 | 1502 |
1503 | 1503 |
1504 static i::Handle<i::Object> CallV8HeapFunction(const char* name, | 1504 static i::Handle<i::Object> CallV8HeapFunction(const char* name, |
1505 i::Handle<i::Object> recv, | 1505 i::Handle<i::Object> recv, |
1506 int argc, | 1506 int argc, |
1507 i::Object** argv[], | 1507 i::Object** argv[], |
1508 bool* has_pending_exception) { | 1508 bool* has_pending_exception) { |
1509 i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name); | 1509 i::Handle<i::String> fmt_str = i::Factory::LookupAsciiSymbol(name); |
1510 i::Object* object_fun = i::Top::builtins()->GetProperty(*fmt_str); | 1510 i::Object* object_fun = |
| 1511 i::Top::builtins()->GetPropertyNoExceptionThrown(*fmt_str); |
1511 i::Handle<i::JSFunction> fun = | 1512 i::Handle<i::JSFunction> fun = |
1512 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun)); | 1513 i::Handle<i::JSFunction>(i::JSFunction::cast(object_fun)); |
1513 i::Handle<i::Object> value = | 1514 i::Handle<i::Object> value = |
1514 i::Execution::Call(fun, recv, argc, argv, has_pending_exception); | 1515 i::Execution::Call(fun, recv, argc, argv, has_pending_exception); |
1515 return value; | 1516 return value; |
1516 } | 1517 } |
1517 | 1518 |
1518 | 1519 |
1519 static i::Handle<i::Object> CallV8HeapFunction(const char* name, | 1520 static i::Handle<i::Object> CallV8HeapFunction(const char* name, |
1520 i::Handle<i::Object> data, | 1521 i::Handle<i::Object> data, |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 } | 1617 } |
1617 | 1618 |
1618 | 1619 |
1619 // --- S t a c k T r a c e --- | 1620 // --- S t a c k T r a c e --- |
1620 | 1621 |
1621 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { | 1622 Local<StackFrame> StackTrace::GetFrame(uint32_t index) const { |
1622 if (IsDeadCheck("v8::StackTrace::GetFrame()")) return Local<StackFrame>(); | 1623 if (IsDeadCheck("v8::StackTrace::GetFrame()")) return Local<StackFrame>(); |
1623 ENTER_V8; | 1624 ENTER_V8; |
1624 HandleScope scope; | 1625 HandleScope scope; |
1625 i::Handle<i::JSArray> self = Utils::OpenHandle(this); | 1626 i::Handle<i::JSArray> self = Utils::OpenHandle(this); |
1626 i::Handle<i::JSObject> obj(i::JSObject::cast(self->GetElement(index))); | 1627 i::Object* raw_object = self->GetElementNoExceptionThrown(index); |
| 1628 i::Handle<i::JSObject> obj(i::JSObject::cast(raw_object)); |
1627 return scope.Close(Utils::StackFrameToLocal(obj)); | 1629 return scope.Close(Utils::StackFrameToLocal(obj)); |
1628 } | 1630 } |
1629 | 1631 |
1630 | 1632 |
1631 int StackTrace::GetFrameCount() const { | 1633 int StackTrace::GetFrameCount() const { |
1632 if (IsDeadCheck("v8::StackTrace::GetFrameCount()")) return -1; | 1634 if (IsDeadCheck("v8::StackTrace::GetFrameCount()")) return -1; |
1633 ENTER_V8; | 1635 ENTER_V8; |
1634 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); | 1636 return i::Smi::cast(Utils::OpenHandle(this)->length())->value(); |
1635 } | 1637 } |
1636 | 1638 |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 Handle<String> key) { | 2534 Handle<String> key) { |
2533 ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()", | 2535 ON_BAILOUT("v8::Object::GetRealNamedPropertyInPrototypeChain()", |
2534 return Local<Value>()); | 2536 return Local<Value>()); |
2535 ENTER_V8; | 2537 ENTER_V8; |
2536 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 2538 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
2537 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 2539 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
2538 i::LookupResult lookup; | 2540 i::LookupResult lookup; |
2539 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); | 2541 self_obj->LookupRealNamedPropertyInPrototypes(*key_obj, &lookup); |
2540 if (lookup.IsProperty()) { | 2542 if (lookup.IsProperty()) { |
2541 PropertyAttributes attributes; | 2543 PropertyAttributes attributes; |
2542 i::Handle<i::Object> result(self_obj->GetProperty(*self_obj, | 2544 i::Object* property = |
2543 &lookup, | 2545 self_obj->GetProperty(*self_obj, |
2544 *key_obj, | 2546 &lookup, |
2545 &attributes)); | 2547 *key_obj, |
| 2548 &attributes)->ToObjectUnchecked(); |
| 2549 i::Handle<i::Object> result(property); |
2546 return Utils::ToLocal(result); | 2550 return Utils::ToLocal(result); |
2547 } | 2551 } |
2548 return Local<Value>(); // No real property was found in prototype chain. | 2552 return Local<Value>(); // No real property was found in prototype chain. |
2549 } | 2553 } |
2550 | 2554 |
2551 | 2555 |
2552 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { | 2556 Local<Value> v8::Object::GetRealNamedProperty(Handle<String> key) { |
2553 ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>()); | 2557 ON_BAILOUT("v8::Object::GetRealNamedProperty()", return Local<Value>()); |
2554 ENTER_V8; | 2558 ENTER_V8; |
2555 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); | 2559 i::Handle<i::JSObject> self_obj = Utils::OpenHandle(this); |
2556 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); | 2560 i::Handle<i::String> key_obj = Utils::OpenHandle(*key); |
2557 i::LookupResult lookup; | 2561 i::LookupResult lookup; |
2558 self_obj->LookupRealNamedProperty(*key_obj, &lookup); | 2562 self_obj->LookupRealNamedProperty(*key_obj, &lookup); |
2559 if (lookup.IsProperty()) { | 2563 if (lookup.IsProperty()) { |
2560 PropertyAttributes attributes; | 2564 PropertyAttributes attributes; |
2561 i::Handle<i::Object> result(self_obj->GetProperty(*self_obj, | 2565 i::Object* property = |
2562 &lookup, | 2566 self_obj->GetProperty(*self_obj, |
2563 *key_obj, | 2567 &lookup, |
2564 &attributes)); | 2568 *key_obj, |
| 2569 &attributes)->ToObjectUnchecked(); |
| 2570 i::Handle<i::Object> result(property); |
2565 return Utils::ToLocal(result); | 2571 return Utils::ToLocal(result); |
2566 } | 2572 } |
2567 return Local<Value>(); // No real property was found in prototype chain. | 2573 return Local<Value>(); // No real property was found in prototype chain. |
2568 } | 2574 } |
2569 | 2575 |
2570 | 2576 |
2571 // Turns on access checks by copying the map and setting the check flag. | 2577 // Turns on access checks by copying the map and setting the check flag. |
2572 // Because the object gets a new map, existing inline cache caching | 2578 // Because the object gets a new map, existing inline cache caching |
2573 // the old map of this object will fail. | 2579 // the old map of this object will fail. |
2574 void v8::Object::TurnOnAccessCheck() { | 2580 void v8::Object::TurnOnAccessCheck() { |
(...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4987 | 4993 |
4988 | 4994 |
4989 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 4995 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
4990 HandleScopeImplementer* thread_local = | 4996 HandleScopeImplementer* thread_local = |
4991 reinterpret_cast<HandleScopeImplementer*>(storage); | 4997 reinterpret_cast<HandleScopeImplementer*>(storage); |
4992 thread_local->IterateThis(v); | 4998 thread_local->IterateThis(v); |
4993 return storage + ArchiveSpacePerThread(); | 4999 return storage + ArchiveSpacePerThread(); |
4994 } | 5000 } |
4995 | 5001 |
4996 } } // namespace v8::internal | 5002 } } // namespace v8::internal |
OLD | NEW |