| 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 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 | 1097 |
| 1098 Isolate* isolate = args.GetIsolate(); | 1098 Isolate* isolate = args.GetIsolate(); |
| 1099 uint8_t* data = reinterpret_cast<uint8_t*>( | 1099 uint8_t* data = reinterpret_cast<uint8_t*>( |
| 1100 ReadChars(args.GetIsolate(), *filename, &length)); | 1100 ReadChars(args.GetIsolate(), *filename, &length)); |
| 1101 if (data == NULL) { | 1101 if (data == NULL) { |
| 1102 Throw("Error reading file"); | 1102 Throw("Error reading file"); |
| 1103 return; | 1103 return; |
| 1104 } | 1104 } |
| 1105 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length); | 1105 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(data, length); |
| 1106 v8::Persistent<v8::Value> weak_handle(isolate, buffer); | 1106 v8::Persistent<v8::Value> weak_handle(isolate, buffer); |
| 1107 weak_handle.MakeWeak(isolate, data, ReadBufferWeakCallback); | 1107 weak_handle.MakeWeak(data, ReadBufferWeakCallback); |
| 1108 weak_handle.MarkIndependent(); | 1108 weak_handle.MarkIndependent(); |
| 1109 isolate->AdjustAmountOfExternalAllocatedMemory(length); | 1109 isolate->AdjustAmountOfExternalAllocatedMemory(length); |
| 1110 | 1110 |
| 1111 args.GetReturnValue().Set(buffer); | 1111 args.GetReturnValue().Set(buffer); |
| 1112 } | 1112 } |
| 1113 | 1113 |
| 1114 | 1114 |
| 1115 #ifndef V8_SHARED | 1115 #ifndef V8_SHARED |
| 1116 static char* ReadToken(char* data, char token) { | 1116 static char* ReadToken(char* data, char token) { |
| 1117 char* next = i::OS::StrChr(data, token); | 1117 char* next = i::OS::StrChr(data, token); |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 } | 1656 } |
| 1657 | 1657 |
| 1658 } // namespace v8 | 1658 } // namespace v8 |
| 1659 | 1659 |
| 1660 | 1660 |
| 1661 #ifndef GOOGLE3 | 1661 #ifndef GOOGLE3 |
| 1662 int main(int argc, char* argv[]) { | 1662 int main(int argc, char* argv[]) { |
| 1663 return v8::Shell::Main(argc, argv); | 1663 return v8::Shell::Main(argc, argv); |
| 1664 } | 1664 } |
| 1665 #endif | 1665 #endif |
| OLD | NEW |