| OLD | NEW | 
|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 520 | 520 | 
| 521 | 521 | 
| 522 // Unwraps JSValue object, returning its field "value" | 522 // Unwraps JSValue object, returning its field "value" | 
| 523 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { | 523 static Handle<Object> UnwrapJSValue(Handle<JSValue> jsValue) { | 
| 524   return Handle<Object>(jsValue->value()); | 524   return Handle<Object>(jsValue->value()); | 
| 525 } | 525 } | 
| 526 | 526 | 
| 527 | 527 | 
| 528 // Wraps any object into a OpaqueReference, that will hide the object | 528 // Wraps any object into a OpaqueReference, that will hide the object | 
| 529 // from JavaScript. | 529 // from JavaScript. | 
| 530 static Handle<JSValue> WrapInJSValue(Object* object) { | 530 static Handle<JSValue> WrapInJSValue(Handle<Object> object) { | 
| 531   Handle<JSFunction> constructor = | 531   Handle<JSFunction> constructor = | 
| 532       Isolate::Current()->opaque_reference_function(); | 532       Isolate::Current()->opaque_reference_function(); | 
| 533   Handle<JSValue> result = | 533   Handle<JSValue> result = | 
| 534       Handle<JSValue>::cast(FACTORY->NewJSObject(constructor)); | 534       Handle<JSValue>::cast(FACTORY->NewJSObject(constructor)); | 
| 535   result->set_value(object); | 535   result->set_value(*object); | 
| 536   return result; | 536   return result; | 
| 537 } | 537 } | 
| 538 | 538 | 
| 539 | 539 | 
| 540 // Simple helper class that creates more or less typed structures over | 540 // Simple helper class that creates more or less typed structures over | 
| 541 // JSArray object. This is an adhoc method of passing structures from C++ | 541 // JSArray object. This is an adhoc method of passing structures from C++ | 
| 542 // to JavaScript. | 542 // to JavaScript. | 
| 543 template<typename S> | 543 template<typename S> | 
| 544 class JSArrayBasedStruct { | 544 class JSArrayBasedStruct { | 
| 545  public: | 545  public: | 
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 592                             int end_position, int param_num, int parent_index) { | 592                             int end_position, int param_num, int parent_index) { | 
| 593     HandleScope scope; | 593     HandleScope scope; | 
| 594     this->SetField(kFunctionNameOffset_, name); | 594     this->SetField(kFunctionNameOffset_, name); | 
| 595     this->SetSmiValueField(kStartPositionOffset_, start_position); | 595     this->SetSmiValueField(kStartPositionOffset_, start_position); | 
| 596     this->SetSmiValueField(kEndPositionOffset_, end_position); | 596     this->SetSmiValueField(kEndPositionOffset_, end_position); | 
| 597     this->SetSmiValueField(kParamNumOffset_, param_num); | 597     this->SetSmiValueField(kParamNumOffset_, param_num); | 
| 598     this->SetSmiValueField(kParentIndexOffset_, parent_index); | 598     this->SetSmiValueField(kParentIndexOffset_, parent_index); | 
| 599   } | 599   } | 
| 600   void SetFunctionCode(Handle<Code> function_code, | 600   void SetFunctionCode(Handle<Code> function_code, | 
| 601       Handle<Object> code_scope_info) { | 601       Handle<Object> code_scope_info) { | 
| 602     Handle<JSValue> code_wrapper = WrapInJSValue(*function_code); | 602     Handle<JSValue> code_wrapper = WrapInJSValue(function_code); | 
| 603     this->SetField(kCodeOffset_, code_wrapper); | 603     this->SetField(kCodeOffset_, code_wrapper); | 
| 604 | 604 | 
| 605     Handle<JSValue> scope_wrapper = WrapInJSValue(*code_scope_info); | 605     Handle<JSValue> scope_wrapper = WrapInJSValue(code_scope_info); | 
| 606     this->SetField(kCodeScopeInfoOffset_, scope_wrapper); | 606     this->SetField(kCodeScopeInfoOffset_, scope_wrapper); | 
| 607   } | 607   } | 
| 608   void SetOuterScopeInfo(Handle<Object> scope_info_array) { | 608   void SetOuterScopeInfo(Handle<Object> scope_info_array) { | 
| 609     this->SetField(kOuterScopeInfoOffset_, scope_info_array); | 609     this->SetField(kOuterScopeInfoOffset_, scope_info_array); | 
| 610   } | 610   } | 
| 611   void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) { | 611   void SetSharedFunctionInfo(Handle<SharedFunctionInfo> info) { | 
| 612     Handle<JSValue> info_holder = WrapInJSValue(*info); | 612     Handle<JSValue> info_holder = WrapInJSValue(info); | 
| 613     this->SetField(kSharedFunctionInfoOffset_, info_holder); | 613     this->SetField(kSharedFunctionInfoOffset_, info_holder); | 
| 614   } | 614   } | 
| 615   int GetParentIndex() { | 615   int GetParentIndex() { | 
| 616     return this->GetSmiValueField(kParentIndexOffset_); | 616     return this->GetSmiValueField(kParentIndexOffset_); | 
| 617   } | 617   } | 
| 618   Handle<Code> GetFunctionCode() { | 618   Handle<Code> GetFunctionCode() { | 
| 619     Handle<Object> raw_result = UnwrapJSValue(Handle<JSValue>( | 619     Handle<Object> raw_result = UnwrapJSValue(Handle<JSValue>( | 
| 620         JSValue::cast(this->GetField(kCodeOffset_)))); | 620         JSValue::cast(this->GetField(kCodeOffset_)))); | 
| 621     return Handle<Code>::cast(raw_result); | 621     return Handle<Code>::cast(raw_result); | 
| 622   } | 622   } | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 659   } | 659   } | 
| 660 | 660 | 
| 661   explicit SharedInfoWrapper(Handle<JSArray> array) | 661   explicit SharedInfoWrapper(Handle<JSArray> array) | 
| 662       : JSArrayBasedStruct<SharedInfoWrapper>(array) { | 662       : JSArrayBasedStruct<SharedInfoWrapper>(array) { | 
| 663   } | 663   } | 
| 664 | 664 | 
| 665   void SetProperties(Handle<String> name, int start_position, int end_position, | 665   void SetProperties(Handle<String> name, int start_position, int end_position, | 
| 666                      Handle<SharedFunctionInfo> info) { | 666                      Handle<SharedFunctionInfo> info) { | 
| 667     HandleScope scope; | 667     HandleScope scope; | 
| 668     this->SetField(kFunctionNameOffset_, name); | 668     this->SetField(kFunctionNameOffset_, name); | 
| 669     Handle<JSValue> info_holder = WrapInJSValue(*info); | 669     Handle<JSValue> info_holder = WrapInJSValue(info); | 
| 670     this->SetField(kSharedInfoOffset_, info_holder); | 670     this->SetField(kSharedInfoOffset_, info_holder); | 
| 671     this->SetSmiValueField(kStartPositionOffset_, start_position); | 671     this->SetSmiValueField(kStartPositionOffset_, start_position); | 
| 672     this->SetSmiValueField(kEndPositionOffset_, end_position); | 672     this->SetSmiValueField(kEndPositionOffset_, end_position); | 
| 673   } | 673   } | 
| 674   Handle<SharedFunctionInfo> GetInfo() { | 674   Handle<SharedFunctionInfo> GetInfo() { | 
| 675     Object* element = this->GetField(kSharedInfoOffset_); | 675     Object* element = this->GetField(kSharedInfoOffset_); | 
| 676     Handle<JSValue> value_wrapper(JSValue::cast(element)); | 676     Handle<JSValue> value_wrapper(JSValue::cast(element)); | 
| 677     Handle<Object> raw_result = UnwrapJSValue(value_wrapper); | 677     Handle<Object> raw_result = UnwrapJSValue(value_wrapper); | 
| 678     return Handle<SharedFunctionInfo>::cast(raw_result); | 678     return Handle<SharedFunctionInfo>::cast(raw_result); | 
| 679   } | 679   } | 
| (...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1681 | 1681 | 
| 1682 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 1682 bool LiveEditFunctionTracker::IsActive(Isolate* isolate) { | 
| 1683   return false; | 1683   return false; | 
| 1684 } | 1684 } | 
| 1685 | 1685 | 
| 1686 #endif  // ENABLE_DEBUGGER_SUPPORT | 1686 #endif  // ENABLE_DEBUGGER_SUPPORT | 
| 1687 | 1687 | 
| 1688 | 1688 | 
| 1689 | 1689 | 
| 1690 } }  // namespace v8::internal | 1690 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|