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 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 | 1126 |
1127 Isolate* isolate = args.GetIsolate(); | 1127 Isolate* isolate = args.GetIsolate(); |
1128 DataAndPersistent* data = new DataAndPersistent; | 1128 DataAndPersistent* data = new DataAndPersistent; |
1129 data->data = reinterpret_cast<uint8_t*>( | 1129 data->data = reinterpret_cast<uint8_t*>( |
1130 ReadChars(args.GetIsolate(), *filename, &length)); | 1130 ReadChars(args.GetIsolate(), *filename, &length)); |
1131 if (data->data == NULL) { | 1131 if (data->data == NULL) { |
1132 delete data; | 1132 delete data; |
1133 Throw(args.GetIsolate(), "Error reading file"); | 1133 Throw(args.GetIsolate(), "Error reading file"); |
1134 return; | 1134 return; |
1135 } | 1135 } |
1136 Handle<v8::ArrayBuffer> buffer = ArrayBuffer::New(isolate, data, length); | 1136 Handle<v8::ArrayBuffer> buffer = |
| 1137 ArrayBuffer::New(isolate, data->data, length); |
1137 data->handle.Reset(isolate, buffer); | 1138 data->handle.Reset(isolate, buffer); |
1138 data->handle.SetWeak(data, ReadBufferWeakCallback); | 1139 data->handle.SetWeak(data, ReadBufferWeakCallback); |
1139 data->handle.MarkIndependent(); | 1140 data->handle.MarkIndependent(); |
1140 isolate->AdjustAmountOfExternalAllocatedMemory(length); | 1141 isolate->AdjustAmountOfExternalAllocatedMemory(length); |
1141 | 1142 |
1142 args.GetReturnValue().Set(buffer); | 1143 args.GetReturnValue().Set(buffer); |
1143 } | 1144 } |
1144 | 1145 |
1145 | 1146 |
1146 #ifndef V8_SHARED | 1147 #ifndef V8_SHARED |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1762 } | 1763 } |
1763 | 1764 |
1764 } // namespace v8 | 1765 } // namespace v8 |
1765 | 1766 |
1766 | 1767 |
1767 #ifndef GOOGLE3 | 1768 #ifndef GOOGLE3 |
1768 int main(int argc, char* argv[]) { | 1769 int main(int argc, char* argv[]) { |
1769 return v8::Shell::Main(argc, argv); | 1770 return v8::Shell::Main(argc, argv); |
1770 } | 1771 } |
1771 #endif | 1772 #endif |
OLD | NEW |