| OLD | NEW |
| 1 // Copyright 2007-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2007-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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 return ExternalReference(id, CcTest::i_isolate()).address(); | 51 return ExternalReference(id, CcTest::i_isolate()).address(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 | 54 |
| 55 template <class T> | 55 template <class T> |
| 56 static uint32_t Encode(const ExternalReferenceEncoder& encoder, T id) { | 56 static uint32_t Encode(const ExternalReferenceEncoder& encoder, T id) { |
| 57 return encoder.Encode(AddressOf(id)); | 57 return encoder.Encode(AddressOf(id)); |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 static uint32_t make_code(TypeCode type, int id) { | 61 static int make_code(TypeCode type, int id) { |
| 62 return static_cast<uint32_t>(type) << kReferenceTypeShift | id; | 62 return static_cast<uint32_t>(type) << kReferenceTypeShift | id; |
| 63 } | 63 } |
| 64 | 64 |
| 65 | 65 |
| 66 TEST(ExternalReferenceEncoder) { | 66 TEST(ExternalReferenceEncoder) { |
| 67 Isolate* isolate = CcTest::i_isolate(); | 67 Isolate* isolate = CcTest::i_isolate(); |
| 68 v8::V8::Initialize(); | 68 v8::V8::Initialize(); |
| 69 | 69 |
| 70 ExternalReferenceEncoder encoder(isolate); | 70 ExternalReferenceEncoder encoder(isolate); |
| 71 CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode), | 71 CHECK_EQ(make_code(BUILTIN, Builtins::kArrayCode), |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1373 { | 1373 { |
| 1374 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); | 1374 DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2)); |
| 1375 script = v8::ScriptCompiler::CompileUnbound( | 1375 script = v8::ScriptCompiler::CompileUnbound( |
| 1376 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); | 1376 isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache); |
| 1377 } | 1377 } |
| 1378 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); | 1378 v8::Local<v8::Value> result = script->BindToCurrentContext()->Run(); |
| 1379 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); | 1379 CHECK(result->ToString(isolate2)->Equals(v8_str("XY"))); |
| 1380 } | 1380 } |
| 1381 isolate2->Dispose(); | 1381 isolate2->Dispose(); |
| 1382 } | 1382 } |
| OLD | NEW |