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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 Isolate* isolate = obj->GetIsolate(); | 190 Isolate* isolate = obj->GetIsolate(); |
191 CALL_HEAP_FUNCTION(isolate, | 191 CALL_HEAP_FUNCTION(isolate, |
192 Runtime::HasObjectProperty(isolate, obj, key), Object); | 192 Runtime::HasObjectProperty(isolate, obj, key), Object); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 Handle<Object> GetProperty(Handle<JSReceiver> obj, | 196 Handle<Object> GetProperty(Handle<JSReceiver> obj, |
197 const char* name) { | 197 const char* name) { |
198 Isolate* isolate = obj->GetIsolate(); | 198 Isolate* isolate = obj->GetIsolate(); |
199 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); | 199 Handle<String> str = isolate->factory()->InternalizeUtf8String(name); |
200 CALL_HEAP_FUNCTION(isolate, obj->GetProperty(*str), Object); | 200 ASSERT(!str.is_null()); |
| 201 return Object::GetPropertyOrElement(obj, str); |
201 } | 202 } |
202 | 203 |
203 | 204 |
204 Handle<Object> GetProperty(Isolate* isolate, | |
205 Handle<Object> obj, | |
206 Handle<Object> key) { | |
207 CALL_HEAP_FUNCTION(isolate, | |
208 Runtime::GetObjectProperty(isolate, obj, key), Object); | |
209 } | |
210 | |
211 | |
212 Handle<String> LookupSingleCharacterStringFromCode(Isolate* isolate, | 205 Handle<String> LookupSingleCharacterStringFromCode(Isolate* isolate, |
213 uint32_t index) { | 206 uint32_t index) { |
214 CALL_HEAP_FUNCTION( | 207 CALL_HEAP_FUNCTION( |
215 isolate, | 208 isolate, |
216 isolate->heap()->LookupSingleCharacterStringFromCode(index), | 209 isolate->heap()->LookupSingleCharacterStringFromCode(index), |
217 String); | 210 String); |
218 } | 211 } |
219 | 212 |
220 | 213 |
221 // Wrappers for scripts are kept alive and cached in weak global | 214 // Wrappers for scripts are kept alive and cached in weak global |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 result); | 463 result); |
471 } | 464 } |
472 | 465 |
473 | 466 |
474 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) { | 467 Handle<Object> GetScriptNameOrSourceURL(Handle<Script> script) { |
475 Isolate* isolate = script->GetIsolate(); | 468 Isolate* isolate = script->GetIsolate(); |
476 Handle<String> name_or_source_url_key = | 469 Handle<String> name_or_source_url_key = |
477 isolate->factory()->InternalizeOneByteString( | 470 isolate->factory()->InternalizeOneByteString( |
478 STATIC_ASCII_VECTOR("nameOrSourceURL")); | 471 STATIC_ASCII_VECTOR("nameOrSourceURL")); |
479 Handle<JSValue> script_wrapper = GetScriptWrapper(script); | 472 Handle<JSValue> script_wrapper = GetScriptWrapper(script); |
480 Handle<Object> property = GetProperty(isolate, | 473 Handle<Object> property = |
481 script_wrapper, | 474 Object::GetProperty(script_wrapper, name_or_source_url_key); |
482 name_or_source_url_key); | |
483 ASSERT(property->IsJSFunction()); | 475 ASSERT(property->IsJSFunction()); |
484 Handle<JSFunction> method = Handle<JSFunction>::cast(property); | 476 Handle<JSFunction> method = Handle<JSFunction>::cast(property); |
485 bool caught_exception; | 477 bool caught_exception; |
486 Handle<Object> result = Execution::TryCall(method, script_wrapper, 0, | 478 Handle<Object> result = Execution::TryCall(method, script_wrapper, 0, |
487 NULL, &caught_exception); | 479 NULL, &caught_exception); |
488 if (caught_exception) { | 480 if (caught_exception) { |
489 result = isolate->factory()->undefined_value(); | 481 result = isolate->factory()->undefined_value(); |
490 } | 482 } |
491 return result; | 483 return result; |
492 } | 484 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 Handle<Code> code) { | 759 Handle<Code> code) { |
768 heap->EnsureWeakObjectToCodeTable(); | 760 heap->EnsureWeakObjectToCodeTable(); |
769 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); | 761 Handle<DependentCode> dep(heap->LookupWeakObjectToCodeDependency(*object)); |
770 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); | 762 dep = DependentCode::Insert(dep, DependentCode::kWeaklyEmbeddedGroup, code); |
771 CALL_HEAP_FUNCTION_VOID(heap->isolate(), | 763 CALL_HEAP_FUNCTION_VOID(heap->isolate(), |
772 heap->AddWeakObjectToCodeDependency(*object, *dep)); | 764 heap->AddWeakObjectToCodeDependency(*object, *dep)); |
773 } | 765 } |
774 | 766 |
775 | 767 |
776 } } // namespace v8::internal | 768 } } // namespace v8::internal |
OLD | NEW |